/* Tax Calculator Custom Styles - Replacing Tailwind CSS */

/* Variables */
:root {
    --primary: #f97316; /* orange-500 */
    --primary-hover: #ea580c; /* orange-600 */
    --bg-page: #f9fafb; /* gray-50 */
    --border-color: #f3f4f6; /* gray-100 */
    --border-dark: #e5e7eb; /* gray-200 */
    --text-main: #1f2937; /* gray-800 */
    --text-muted: #6b7280; /* gray-500 */
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-400: #9ca3af;
    --gray-100: #f3f4f6;
    --white: #ffffff;
    --success: #16a34a; /* green-600 */
    --orange-100: #ffedd5;
    --orange-700: #c2410c;
    --blue-100: #dbeafe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --green-100: #dcfce7;
    --green-500: #22c55e;
    --green-600: #16a34a;
}

/* Base Styles */
body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* Utilities */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}
@media (min-width: 640px) { .container { max-width: 640px; } }
@media (min-width: 768px) { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }
.block { display: block; }

@media (min-width: 768px) {
    .md-flex { display: flex; }
    .md-hidden { display: none; }
    .md-block { display: block; }
    .md-flex-row { flex-direction: row; }
}

.gap-8 { gap: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.p-6 { padding: 1.5rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-6 > * + * { margin-left: 1.5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.icon-sm { width: 1.25rem; height: 1.25rem; }
.icon-lg { width: 2rem; height: 2rem; }

.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.text-orange { color: var(--primary); }
.text-orange:hover { color: var(--primary-hover); }
.hover\:text-orange-600:hover { color: var(--primary-hover); }
.text-green { color: var(--success); }
.text-gray-500 { color: var(--text-muted); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-800 { color: var(--text-main); }
.bg-white { background-color: white; }

.rounded-xl { border-radius: 0.75rem; }
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.list-disc { list-style-type: disc; }
.list-inside { list-style-position: inside; }

.link-icon-box {
    display: flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 0.375rem; margin-right: 0.75rem;
}
.bg-orange-soft { background-color: var(--orange-100); color: var(--orange-700); }
.bg-blue-soft { background-color: var(--blue-100); color: var(--blue-600); }
.bg-green-soft { background-color: var(--green-100); color: var(--green-500); }

/* Footer */
.footer {
    margin-top: auto;
    padding: 2rem 0;
    border-top: 1px solid var(--border-dark);
    background-color: white;
}
.footer-link { color: var(--text-muted); transition: color 0.2s; }
.footer-link:hover { color: var(--primary); }

/* Back to Top */
#back-to-top {
    position: fixed; bottom: 2rem; right: 2rem;
    background-color: white; color: var(--text-muted);
    padding: 0.75rem; border-radius: 50%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s; opacity: 0; visibility: hidden;
}
#back-to-top.show { opacity: 1; visibility: visible; }
#back-to-top:hover { color: var(--primary); transform: translateY(-2px); }

/* Navbar */
.navbar {
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.nav-inner { padding-top: 1rem; padding-bottom: 1rem; }
.nav-brand { font-size: 1.25rem; font-weight: 700; transition: color 0.3s; }
.nav-brand:hover { color: #f3f4f6; }
.nav-link { transition: color 0.3s; font-size: 0.875rem; font-weight: 500; }
.nav-link:hover { color: #fef08a; }

/* Mobile Menu */
.mobile-btn { padding: 0; background: none; border: none; color: white; cursor: pointer; }
.mobile-menu-link {
    display: block; padding: 0.5rem; border-radius: 0.25rem;
    transition: background-color 0.2s;
}
.mobile-menu-link:hover { background-color: rgba(255, 255, 255, 0.1); }

/* Layout Grid */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
    flex-grow: 1;
}
@media (min-width: 768px) {
    .main-layout { flex-direction: row; }
    .layout-main { width: 75%; }
    .layout-sidebar { width: 25%; }
}
.layout-main, .layout-sidebar { width: 100%; }

/* Components */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(249, 250, 251, 0.5);
}
.card-body { padding: 1.5rem; }
@media (min-width: 768px) { .card-body { padding: 2rem; } }

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex; align-items: center;
    margin: 0;
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    margin-left: 2.75rem;
}

/* Calculator Form */
.mode-switcher {
    display: flex;
    background-color: var(--gray-100);
    padding: 0.25rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}
.switch-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.switch-btn.active {
    background-color: white;
    color: var(--primary-hover);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.switch-btn.inactive {
    background-color: transparent;
    color: var(--text-muted);
}
.switch-btn.inactive:hover { color: var(--text-main); }

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
@media (min-width: 768px) { .form-row { grid-template-columns: 1fr 1fr; } }

.input-label {
    display: block;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.input-group { position: relative; }
.currency-symbol {
    position: absolute; left: 0.75rem; top: 0.75rem; color: var(--gray-400);
}
.form-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 1.125rem;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}
.form-input:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--primary);
}

/* Force spin buttons to be always visible */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    opacity: 1;
}

.rate-options {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.rate-tag {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.rate-tag.active { background-color: var(--orange-100); color: var(--orange-700); }
.rate-tag.inactive { background-color: var(--gray-100); color: var(--gray-600); }
.rate-tag.inactive:hover { background-color: #e5e7eb; }

.submit-btn {
    width: 100%;
    background: linear-gradient(to right, var(--primary), #ef4444);
    color: white;
    font-weight: 700;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
    margin-bottom: 2.5rem;
}
.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(249, 115, 22, 0.4);
}
.submit-btn:active { transform: scale(0.98); }

/* Result Display */
.result-container {
    background-color: var(--bg-page);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-dark);
    position: relative;
}
.result-badge {
    position: absolute;
    top: -0.75rem;
    left: 1.5rem;
    background: white;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border-dark);
    border-radius: 0.25rem;
}
.result-flex {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
}
@media (min-width: 768px) {
    .result-flex { grid-template-columns: 1fr 1fr 1fr; gap: 0; }
    .result-col:not(:last-child) { border-right: 1px solid var(--border-dark); }
}
.result-col { padding: 1rem; }
.res-label { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 0.5rem; }
.res-val { font-size: 1.5rem; font-weight: 700; word-break: break-all; }
.res-unit { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.25rem; }

/* Sidebar */
.sidebar-sticky { position: sticky; top: 1.5rem; }
.sidebar-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}
.sidebar-header {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    padding-left: 0.75rem;
    border-left: 4px solid var(--primary);
    margin-top: 0;
}
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}
.sidebar-link:hover { background-color: #fff7ed; }
.sidebar-link:hover .link-text { color: var(--primary-hover); }
.link-icon-box {
    padding: 0.5rem;
    border-radius: 0.375rem;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bg-orange-soft { background-color: var(--orange-100); color: var(--primary); }
.bg-blue-soft { background-color: var(--blue-100); color: var(--blue-500); }
.bg-green-soft { background-color: var(--green-100); color: var(--green-500); }
.sidebar-link:hover .bg-orange-soft { background-color: var(--orange-200); }
.link-text { color: var(--gray-600); font-weight: 500; }

/* Footer */
.footer { background-color: var(--text-main); color: var(--gray-400); padding: 2rem 0; margin-top: auto; }
.footer-text { margin-bottom: 1rem; font-size: 0.875rem; }
.footer-link:hover { color: white; }
.text-orange { color: var(--primary); }
.text-orange:hover { color: var(--primary-hover); }

/* Back to Top */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--primary);
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.5rem);
}
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top:hover { background-color: var(--primary-hover); }

/* Icons */
.icon-sm { width: 1.25rem; height: 1.25rem; }
.icon-md { width: 1.5rem; height: 1.5rem; }
.icon-lg { width: 2rem; height: 2rem; }
