/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --light: #f3f4f6;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --bg: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: #f9fafb;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 100;
    text-decoration: none;
}

.skip-link:focus {
    top: 10px;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.lg-flex {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .lg-flex {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        grid-column: 1;
    }
}

/* Header */
header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: 80vh;
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Typography */
h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    color: var(--text);
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Warning Box */
.warning-box {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0.25rem;
    color: #78350f;
}

/* Grid System */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Form Elements */
.input-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 0.95rem;
}

input[type="number"],
input[type="text"],
select {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-hint {
    color: var(--text-muted);
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Unit Selection */
.unit-selection {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.unit-selection .title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    display: block;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.radio-label:hover {
    color: var(--primary);
}

.unit-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.4;
}

.unit-note-hidden {
    display: none;
}

/* Nisab Info */
.nisab-info {
    background: #f0f9ff;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.nisab-info h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.nisab-toggle {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Results */
.results-container {
    background: white;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    display: none;
    margin-top: 2rem;
}

.formula-display {
    background: #f0f9ff;
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 0.25rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--light);
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.result-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.result-zakat {
    background: #f0fdf4;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--success);
    margin-top: 1rem;
    text-align: center;
}

.result-zakat-label {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.result-zakat-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success);
}

.result-zakat-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Radio Buttons */
input[type="radio"] {
    accent-color: var(--primary);
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    padding: 0.75rem 1rem;
    color: var(--primary);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background: var(--light);
    padding-left: 1.25rem;
}

/* Footer */
footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Educational Content */
ul {
    margin: 1rem 0 1rem 2rem;
    color: var(--text);
}

li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .radio-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}