/* SmartCalcs - Complete Mobile Responsive Design */

/* ===== MOBILE-FIRST RESPONSIVE FOUNDATION ===== */
:root {
    /* Mobile breakpoints */
    --mobile-sm: 320px;
    --mobile-md: 375px;
    --mobile-lg: 414px;
    --tablet: 768px;
    --desktop: 1024px;
    --desktop-lg: 1200px;
    
    /* Touch-friendly sizes */
    --touch-target: 48px;
    --touch-target-small: 44px;
    --touch-margin: 8px;
    
    /* Mobile spacing */
    --mobile-space-xs: 4px;
    --mobile-space-sm: 8px;
    --mobile-space-md: 16px;
    --mobile-space-lg: 24px;
    --mobile-space-xl: 32px;
    
    /* Mobile typography */
    --mobile-font-xs: 12px;
    --mobile-font-sm: 14px;
    --mobile-font-base: 16px;
    --mobile-font-lg: 18px;
    --mobile-font-xl: 20px;
    --mobile-font-xxl: 24px;
    --mobile-font-hero: 28px;
}

/* ===== MOBILE NAVIGATION SYSTEM ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--mobile-space-md);
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* Mobile Logo */
.nav-logo, .nav-brand .brand-link, .brand-link {
    display: flex;
    align-items: center;
    gap: var(--mobile-space-sm);
    text-decoration: none;
    color: #333;
    font-weight: 700;
    font-size: var(--mobile-font-lg);
    transition: transform 0.3s ease;
}

.nav-logo:hover, .brand-link:hover {
    transform: scale(1.05);
}

.logo-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.brand-text {
    font-size: var(--mobile-font-lg);
    font-weight: 700;
    color: #ff9966;
}

/* Mobile Hamburger Toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--mobile-space-sm);
    border-radius: 8px;
    transition: all 0.3s ease;
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    justify-content: center;
    align-items: center;
}

.nav-toggle:hover {
    background: rgba(255, 153, 102, 0.1);
}

.hamburger-icon {
    font-size: 20px;
    color: #333;
    transition: transform 0.3s ease;
}

.nav-toggle.active .hamburger-icon {
    transform: rotate(90deg);
}

/* Desktop Navigation Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--mobile-space-lg);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    padding: var(--mobile-space-sm) var(--mobile-space-md);
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: var(--touch-target-small);
    display: flex;
    align-items: center;
    font-size: var(--mobile-font-sm);
}

.nav-link:hover {
    background: rgba(255, 153, 102, 0.1);
    color: #ff9966;
    transform: translateY(-2px);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: ' ▼';
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.3s ease;
}

.dropdown:hover .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 999;
    padding: var(--mobile-space-sm);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: var(--mobile-space-md);
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: var(--mobile-font-sm);
}

.dropdown-menu a:hover {
    background: rgba(255, 153, 102, 0.1);
    color: #ff9966;
    transform: translateX(5px);
}

/* ===== MOBILE RESPONSIVE BREAKPOINTS ===== */

/* Mobile Devices (up to 768px) */
@media (max-width: 768px) {
    /* Mobile navigation adjustments */
    .nav-container {
        padding: var(--mobile-space-md) var(--mobile-space-md);
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: var(--mobile-space-lg);
        gap: var(--mobile-space-md);
        transform: translateY(-100vh);
        transition: transform 0.3s ease;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        align-items: stretch;
    }
    
    .nav-links.active {
        transform: translateY(0);
    }
    
    .nav-link {
        width: 100%;
        padding: var(--mobile-space-md);
        text-align: center;
        border-radius: 12px;
        font-size: var(--mobile-font-base);
        min-height: var(--touch-target);
        justify-content: center;
    }
    
    /* Mobile dropdown */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.1);
        margin-top: var(--mobile-space-sm);
        display: none;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown-toggle {
        cursor: pointer;
    }
    
    /* Logo adjustments */
    .logo-icon {
        width: 28px;
        height: 28px;
    }
    
    .brand-text {
        font-size: var(--mobile-font-base);
    }
}

/* ===== MOBILE BODY ADJUSTMENTS ===== */
body {
    padding-top: 70px; /* Account for fixed navbar */
    font-size: var(--mobile-font-base);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
        font-size: var(--mobile-font-base);
    }
}

/* ===== MOBILE CONTAINER SYSTEM ===== */
.container, .section-container, .gst-container, .sip-container, .emi-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--mobile-space-md);
}

@media (max-width: 768px) {
    .container, .section-container, .gst-container, .sip-container, .emi-container {
        padding: 0 var(--mobile-space-md);
    }
}

/* ===== MOBILE GRID SYSTEM ===== */
.calculator-grid, .tools-grid, .stats-grid {
    display: grid;
    gap: var(--mobile-space-lg);
}

@media (max-width: 768px) {
    .calculator-grid, .tools-grid {
        grid-template-columns: 1fr;
        gap: var(--mobile-space-md);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--mobile-space-md);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== MOBILE CARDS ===== */
.card, .tool-card, .stat-item {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: var(--mobile-space-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .card, .tool-card, .stat-item {
        padding: var(--mobile-space-md);
        border-radius: 12px;
    }
}

.card:hover, .tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .card:hover, .tool-card:hover {
        transform: translateY(-2px);
    }
}

/* ===== MOBILE FORMS ===== */
.form-group {
    margin-bottom: var(--mobile-space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--mobile-space-sm);
    font-weight: 600;
    color: #333;
    font-size: var(--mobile-font-sm);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: var(--mobile-space-md);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    font-size: var(--mobile-font-base);
    transition: all 0.3s ease;
    min-height: var(--touch-target);
    font-family: inherit;
}

@media (max-width: 768px) {
    .form-group input, .form-group select, .form-group textarea {
        padding: var(--mobile-space-md);
        font-size: var(--mobile-font-base);
        min-height: var(--touch-target);
    }
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #ff9966;
    box-shadow: 0 0 0 4px rgba(255, 153, 102, 0.1);
    transform: translateY(-1px);
}

/* Input with prefix */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: var(--mobile-space-md);
    color: #666;
    font-weight: 600;
    z-index: 2;
    font-size: var(--mobile-font-base);
}

.input-wrapper input {
    padding-left: calc(var(--mobile-space-xl) + 8px);
}

/* ===== MOBILE BUTTONS ===== */
.btn, .tool-btn, .mode-btn, .rate-btn, .hero-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--mobile-space-md) var(--mobile-space-lg);
    background: linear-gradient(135deg, #ff9966, #ffb84d);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: var(--mobile-font-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    text-align: center;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(255, 153, 102, 0.3);
}

@media (max-width: 768px) {
    .btn, .tool-btn, .mode-btn, .rate-btn, .hero-cta {
        padding: var(--mobile-space-md) var(--mobile-space-lg);
        font-size: var(--mobile-font-base);
        min-height: var(--touch-target);
        width: 100%;
        margin: var(--mobile-space-xs) 0;
    }
}

.btn:hover, .tool-btn:hover, .mode-btn:hover, .rate-btn:hover, .hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 153, 102, 0.4);
}

.btn:active, .tool-btn:active, .mode-btn:active, .rate-btn:active {
    transform: translateY(0);
}

/* ===== MOBILE MODE SELECTORS ===== */
.mode-selector {
    display: flex;
    gap: var(--mobile-space-md);
    margin-bottom: var(--mobile-space-lg);
}

@media (max-width: 768px) {
    .mode-selector {
        flex-direction: column;
        gap: var(--mobile-space-sm);
    }
}

.mode-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: var(--mobile-space-lg);
    text-align: center;
    flex-direction: column;
    gap: var(--mobile-space-sm);
}

.mode-btn.active {
    background: linear-gradient(135deg, #ff9966, #ffb84d);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(255, 153, 102, 0.3);
}

.mode-icon {
    font-size: var(--mobile-font-xl);
    display: block;
    margin-bottom: var(--mobile-space-sm);
}

.mode-text {
    font-weight: 600;
    font-size: var(--mobile-font-base);
    display: block;
    margin-bottom: var(--mobile-space-xs);
}

.mode-desc {
    font-size: var(--mobile-font-xs);
    opacity: 0.8;
    line-height: 1.4;
}

/* ===== MOBILE RATE BUTTONS ===== */
.rate-buttons {
    display: flex;
    gap: var(--mobile-space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--mobile-space-md);
}

@media (max-width: 768px) {
    .rate-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--mobile-space-sm);
    }
}

.rate-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: var(--mobile-space-md);
    text-align: center;
    min-width: 80px;
    flex-direction: column;
    gap: var(--mobile-space-xs);
}

.rate-btn.active {
    background: linear-gradient(135deg, #ff9966, #ffb84d);
    color: white;
    border-color: transparent;
}

.rate-label {
    display: block;
    font-size: var(--mobile-font-xs);
    font-weight: 400;
    opacity: 0.8;
}

/* ===== MOBILE TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: var(--mobile-space-md);
    color: #333;
}

@media (max-width: 768px) {
    h1 {
        font-size: var(--mobile-font-hero);
        margin-bottom: var(--mobile-space-md);
        text-align: center;
    }
    
    h2 {
        font-size: var(--mobile-font-xl);
        margin-bottom: var(--mobile-space-md);
    }
    
    h3 {
        font-size: var(--mobile-font-lg);
        margin-bottom: var(--mobile-space-sm);
    }
    
    h4, h5, h6 {
        font-size: var(--mobile-font-base);
        margin-bottom: var(--mobile-space-sm);
    }
}

/* ===== MOBILE SECTIONS ===== */
.hero-section, .stats-section, .tools-section {
    padding: var(--mobile-space-xl) 0;
}

@media (max-width: 768px) {
    .hero-section, .stats-section, .tools-section {
        padding: var(--mobile-space-lg) 0;
    }
}

.hero-title {
    font-size: clamp(28px, 5vw, 48px);
    margin-bottom: var(--mobile-space-md);
    text-align: center;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(16px, 3vw, 20px);
    margin-bottom: var(--mobile-space-lg);
    text-align: center;
    opacity: 0.8;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== MOBILE RESULTS ===== */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--mobile-space-md) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--mobile-space-xs);
        text-align: left;
    }
    
    .result-value {
        font-size: var(--mobile-font-lg) !important;
        font-weight: 700;
    }
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    color: #333;
    font-size: var(--mobile-font-sm);
}

.result-value {
    font-weight: 600;
    font-size: var(--mobile-font-base);
    color: #ff9966;
}

/* ===== MOBILE UTILITIES ===== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: var(--mobile-space-xs); }
.mt-2 { margin-top: var(--mobile-space-sm); }
.mt-3 { margin-top: var(--mobile-space-md); }
.mt-4 { margin-top: var(--mobile-space-lg); }

.mb-1 { margin-bottom: var(--mobile-space-xs); }
.mb-2 { margin-bottom: var(--mobile-space-sm); }
.mb-3 { margin-bottom: var(--mobile-space-md); }
.mb-4 { margin-bottom: var(--mobile-space-lg); }

.p-1 { padding: var(--mobile-space-xs); }
.p-2 { padding: var(--mobile-space-sm); }
.p-3 { padding: var(--mobile-space-md); }
.p-4 { padding: var(--mobile-space-lg); }

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
    
    .show-mobile.flex {
        display: flex !important;
    }
    
    .show-mobile.inline {
        display: inline !important;
    }
}

/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* iOS Safari specific fixes */
@supports (-webkit-backdrop-filter: blur(20px)) {
    .navbar {
        -webkit-backdrop-filter: blur(20px);
    }
    
    .nav-links {
        -webkit-backdrop-filter: blur(20px);
    }
    
    .dropdown-menu {
        -webkit-backdrop-filter: blur(20px);
    }
}

/* Android Chrome specific fixes */
@media screen and (max-width: 768px) {
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    input[type="number"] {
        -moz-appearance: textfield;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for accessibility */
button:focus, input:focus, select:focus, textarea:focus, a:focus {
    outline: 2px solid #ff9966;
    outline-offset: 2px;
}

/* ===== LOADING STATES ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ff9966;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar, .nav-toggle, .dropdown-menu {
        display: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    .card, .tool-card {
        break-inside: avoid;
    }
}