/* ===========================================
   ZAKAT CALCULATOR - MODERN DESIGN SYSTEM
   =========================================== */

/* CSS Variables for Theming */
:root {
    /* Primary Colors - Purple/Gold */
    --primary: #6B46C1;
    --primary-dark: #553C9A;
    --primary-light: #9F7AEA;
    --accent: #D4AF37;
    --accent-light: #F6E05E;
    
    /* Neutral Colors */
    --bg-primary: #F7FAFC;
    --bg-secondary: #FFFFFF;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --border-color: #E2E8F0;
    
    /* Status Colors */
    --success: #48BB78;
    --warning: #ED8936;
    --error: #F56565;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 20px rgba(107, 70, 193, 0.15);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===========================================
   CALCULATOR CONTAINER
   =========================================== */
.calculator-wrapper {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #EDF2F7 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
}

.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 992px) {
    .calculator-container {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   CALCULATOR HEADER
   =========================================== */
.calculator-header {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 1rem;
}

.calculator-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.calculator-header h1 .icon {
    font-size: 2rem;
}

.calculator-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.calculator-header .disclaimer {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #92400E;
    display: inline-block;
}

/* ===========================================
   PROGRESS BAR
   =========================================== */
.progress-container {
    grid-column: 1 / -1;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-label .percentage {
    font-weight: 600;
    color: var(--primary);
}

.progress-bar-track {
    height: 8px;
    background: var(--border-color);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 100px;
    width: 0%;
    transition: width var(--transition-slow);
}

/* ===========================================
   MAIN CALCULATOR AREA
   =========================================== */
.calculator-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===========================================
   COLLAPSIBLE CARDS
   =========================================== */
.calc-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    border: 1px solid transparent;
}

.calc-card:hover {
    box-shadow: var(--shadow-lg);
}

.calc-card.active {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-glow);
}

.calc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    background: linear-gradient(135deg, #FAFAFA 0%, #F7FAFC 100%);
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    user-select: none;
}

.calc-card-header:hover {
    background: linear-gradient(135deg, #F0F4F8 0%, #EDF2F7 100%);
}

.calc-card-header .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calc-card-header .icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.calc-card-header .header-text h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.calc-card-header .header-text span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.calc-card-header .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calc-card-header .subtotal {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(107, 70, 193, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}

.calc-card-header .toggle-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    color: var(--text-secondary);
}

.calc-card.active .toggle-icon {
    background: var(--primary);
    color: white;
    transform: rotate(180deg);
}

.calc-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow) ease-out;
}

.calc-card.active .calc-card-body {
    max-height: 3000px;
}

.calc-card-content {
    padding: 1.5rem;
}

/* ===========================================
   INPUT FIELDS
   =========================================== */
.input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.input-group:hover {
    background: #EDF2F7;
}

.input-group:focus-within {
    border-color: var(--primary-light);
    background: white;
    box-shadow: var(--shadow-sm);
}

.input-group label {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.input-group .tooltip-icon {
    color: var(--text-muted);
    cursor: help;
    font-size: 0.9rem;
}

.input-group input {
    width: 150px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    text-align: right;
    transition: all var(--transition-fast);
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.input-group input:read-only {
    background: #EDF2F7;
    color: var(--primary);
    font-weight: 600;
    cursor: not-allowed;
}

.input-group.readonly {
    background: linear-gradient(135deg, rgba(107, 70, 193, 0.05) 0%, rgba(107, 70, 193, 0.1) 100%);
}

.input-group.readonly label {
    font-weight: 600;
    color: var(--text-primary);
}

/* Gold/Silver specific styling */
.metal-inputs {
    display: grid;
    grid-template-columns: 1fr 120px 120px 120px;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.metal-inputs label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.metal-inputs input {
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-align: right;
    transition: all var(--transition-fast);
}

.metal-inputs input:focus {
    outline: none;
    border-color: var(--primary);
}

.metal-inputs-header {
    display: grid;
    grid-template-columns: 1fr 120px 120px 120px;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .metal-inputs,
    .metal-inputs-header {
        grid-template-columns: 1fr;
    }
    
    .metal-inputs-header {
        display: none;
    }
    
    .metal-inputs label {
        margin-bottom: 0.5rem;
    }
    
    .metal-inputs input {
        width: 100%;
    }
}

/* ===========================================
   SUMMARY SIDEBAR
   =========================================== */
.calculator-sidebar {
    position: sticky;
    top: 2rem;
}

.summary-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl);
    padding: 2rem;
    color: white;
    box-shadow: var(--shadow-lg);
}

.summary-card h3 {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.summary-item:last-of-type {
    border-bottom: none;
}

.summary-item .label {
    font-size: 0.9rem;
    opacity: 0.85;
}

.summary-item .value {
    font-size: 1rem;
    font-weight: 600;
}

.summary-divider {
    height: 1px;
    background: rgba(255,255,255,0.2);
    margin: 1rem 0;
}

.summary-total {
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
    text-align: center;
}

.summary-total .label {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 0.5rem;
}

.summary-total .amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-light);
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.summary-total .rate {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.donate-btn {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, #B8860B 100%);
    color: #1A202C;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-top: 1.5rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* Mobile Summary */
@media (max-width: 992px) {
    .calculator-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        padding: 0;
    }
    
    .summary-card {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 1rem 1.5rem;
    }
    
    .summary-card h3,
    .summary-item,
    .summary-divider {
        display: none;
    }
    
    .summary-total {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0;
        padding: 0;
        background: transparent;
    }
    
    .summary-total .label {
        margin: 0;
        text-align: left;
    }
    
    .summary-total .amount {
        font-size: 1.5rem;
    }
    
    .summary-total .rate {
        display: none;
    }
    
    .donate-btn {
        margin-top: 1rem;
    }
}

/* ===========================================
   LIABILITIES SPECIAL STYLING
   =========================================== */
.calc-card.liabilities .calc-card-header .icon {
    background: linear-gradient(135deg, var(--error) 0%, #FC8181 100%);
}

.calc-card.liabilities .subtotal {
    color: var(--error);
    background: rgba(245, 101, 101, 0.1);
}

/* ===========================================
   ANIMATION KEYFRAMES
   =========================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.calc-card {
    animation: fadeIn 0.4s ease-out;
}

.summary-total .amount.updated {
    animation: pulse 0.3s ease;
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Hide original table styling when new design active */
.calculator-wrapper #no-more-tables {
    display: none !important;
}

/* ===========================================
   DESKTOP SUMMARY SECTION STYLING
   Only applies to screens >= 993px
   Mobile styles are in mobile-force-fix.css
   =========================================== */
@media (min-width: 993px) {
    .summary-section-bottom {
        background: linear-gradient(135deg, #f8f7fc 0%, #f0ebfa 100%);
        padding: 3rem 0;
        margin-top: 2rem;
    }
    
    .summary-section-bottom .container {
        max-width: 700px;
        margin: 0 auto;
    }
    
    .summary-card-bottom {
        background: #ffffff;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(107, 70, 193, 0.12);
        padding: 2.5rem;
        border: 1px solid rgba(107, 70, 193, 0.1);
    }
    
    .summary-card-bottom h3 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--primary);
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        border-bottom: 2px solid rgba(107, 70, 193, 0.1);
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    
    .summary-card-bottom h3 i {
        width: 44px;
        height: 44px;
        background: linear-gradient(135deg, var(--primary) 0%, #805AD5 100%);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #ffffff;
        font-size: 1.1rem;
        box-shadow: 0 4px 12px rgba(107, 70, 193, 0.3);
    }
    
    .summary-card-bottom .summary-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.875rem 1rem;
        margin-bottom: 0.5rem;
        background: #fafafa;
        border-radius: 10px;
        transition: all 0.2s ease;
    }
    
    .summary-card-bottom .summary-item:hover {
        background: #f5f3fa;
        transform: translateX(4px);
    }
    
    .summary-card-bottom .summary-item .label {
        font-size: 1rem;
        color: var(--text-secondary);
        font-weight: 500;
    }
    
    .summary-card-bottom .summary-item .label strong {
        color: var(--text-primary);
        font-weight: 600;
    }
    
    .summary-card-bottom .summary-item .value {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--primary);
        font-family: 'Inter', sans-serif;
    }
    
    .summary-card-bottom .summary-divider {
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--primary), transparent);
        margin: 1.25rem 0;
        opacity: 0.3;
    }
    
    .summary-card-bottom .summary-total {
        background: linear-gradient(135deg, var(--primary) 0%, #805AD5 100%);
        border-radius: 14px;
        padding: 1.75rem;
        text-align: center;
        margin-top: 1.5rem;
        box-shadow: 0 8px 24px rgba(107, 70, 193, 0.25);
    }
    
    .summary-card-bottom .summary-total .label {
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.95rem;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 0.5rem;
    }
    
    .summary-card-bottom .summary-total .amount {
        color: var(--accent);
        font-size: 2.5rem;
        font-weight: 800;
        font-family: 'Inter', sans-serif;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .summary-card-bottom .summary-total .rate {
        color: rgba(255, 255, 255, 0.75);
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }
    
    .summary-card-bottom .donate-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        width: 100%;
        padding: 1.25rem 2rem;
        margin-top: 1.5rem;
        background: linear-gradient(135deg, var(--accent) 0%, #E6C556 100%);
        color: #1a1a2e;
        font-size: 1.15rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 12px;
        text-decoration: none;
        box-shadow: 0 6px 20px rgba(212, 175, 55, 0.35);
        transition: all 0.3s ease;
    }
    
    .summary-card-bottom .donate-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 30px rgba(212, 175, 55, 0.45);
        background: linear-gradient(135deg, #E6C556 0%, var(--accent) 100%);
    }
    
    .summary-card-bottom .donate-btn i {
        font-size: 1.2rem;
    }
}

/* ===========================================
   CURRENCY SWITCHER
   =========================================== */
.currency-switcher {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.currency-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.currency-toggle {
    display: flex;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
}

.currency-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.currency-btn:hover {
    background: rgba(107, 70, 193, 0.1);
    color: var(--primary);
}

.currency-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(107, 70, 193, 0.3);
}

.currency-btn .currency-flag {
    font-size: 1.2rem;
}

.exchange-rate {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    background: rgba(107, 70, 193, 0.08);
    border-radius: 20px;
}

/* Mobile adjustments for currency switcher */
@media (max-width: 576px) {
    .currency-switcher {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .currency-btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }
    
    .exchange-rate {
        font-size: 0.75rem;
        width: 100%;
        text-align: center;
        margin-top: 0.25rem;
    }
}
