@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=Inter:wght@400;500;600&family=Poppins:wght@500;600;700&display=swap');

:root {
    /* Modern Emerald Palette */
    --primary-gradient: linear-gradient(135deg, #00c853 0%, #009624 100%); /* Lush Green */
    --primary-color: #00c853;
    --secondary-color: #ff3d00;
    --accent-color: #2979ff;
    
    /* Backgrounds */
    --bg-color: #f0f2f5;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    
    /* Text */
    --text-main: #1a1a1a;
    --text-muted: #6b7280;
    
    /* UI Elements */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    
    /* Font */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    --primary-gradient: linear-gradient(135deg, #00e676 0%, #00c853 100%);
}

[dir="rtl"] {
    --font-heading: 'Cairo', sans-serif;
    --font-body: 'Cairo', sans-serif;
}

/* --- Base --- */
body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(143,76%,45%,0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(143,76%,45%,0.1) 0px, transparent 50%);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    padding-bottom: 50px;
    transition: background 0.3s ease;
    overflow-x: hidden;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Navigation & Header --- */
.top-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 30px;
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-main);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.icon-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

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

/* --- Cards (Glassmorphism) --- */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* --- Mode Switcher --- */
.mode-switch {
    background: var(--bg-color);
    padding: 6px;
    border-radius: var(--radius-md);
    display: flex;
    margin-bottom: 30px;
    position: relative;
}

.mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: color 0.3s;
    z-index: 2;
}

.mode-btn.active {
    color: var(--primary-color);
    background: var(--glass-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* --- Inputs --- */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
    transition: transform 0.2s;
}

.input-wrapper:focus-within {
    transform: scale(1.01);
}

.input-wrapper i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 16px;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

[dir="rtl"] .input-wrapper i {
    left: auto;
    right: 16px;
}

input, select {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid transparent;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    color: var(--text-main);
    font-family: var(--font-body);
    transition: all 0.2s;
    box-sizing: border-box;
    font-weight: 500;
}

[dir="rtl"] input, [dir="rtl"] select {
    padding: 16px 48px 16px 16px;
}

input:focus, select:focus {
    outline: none;
    background: var(--glass-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 200, 83, 0.1);
}

/* --- Checkbox --- */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 10px 0;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 24px;
    width: 24px;
    background-color: var(--bg-color);
    border-radius: 6px;
    margin-right: 12px;
    margin-left: 0;
    position: relative;
    transition: all 0.2s;
}

[dir="rtl"] .checkmark {
    margin-right: 0;
    margin-left: 12px;
}

.checkbox-container:hover .checkmark {
    background-color: #ddd;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* --- Calculate Button --- */
.calculate-btn {
    width: 100%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 18px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(0, 200, 83, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(0, 200, 83, 0.5);
}

.calculate-btn:active {
    transform: scale(0.98);
}

/* --- Results --- */
.result-card {
    border-top: 4px solid var(--primary-color);
}

.main-result {
    text-align: center;
    padding: 30px;
    background: linear-gradient(180deg, rgba(0, 200, 83, 0.05) 0%, rgba(0,0,0,0) 100%);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.main-result span:first-child {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.amount {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
    font-family: var(--font-heading);
    line-height: 1.2;
    margin-top: 5px;
}

.amount small {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 5px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 1.05rem;
}

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

.positive span:last-child { color: var(--primary-color); font-weight: 700; }
.negative span:last-child { color: var(--secondary-color); font-weight: 700; }

/* --- Action Buttons --- */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.action-btn {
    flex: 1;
    background: var(--bg-color);
    color: var(--text-main);
    border: none;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: rgba(0,0,0,0.05);
}

.pdf-btn {
    background: var(--text-main);
    color: var(--bg-color);
}

.pdf-btn:hover {
    background: #000;
    transform: translateY(-2px);
}

/* --- Info Section --- */
.content-section {
    margin-top: 50px;
    animation: fadeInUp 0.8s ease-out;
}

.info-item {
    background: var(--bg-color);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.3s;
}

.info-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.info-item h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-family: var(--font-heading);
}

/* --- Animations --- */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* --- Responsive --- */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .amount {
        font-size: 2.5rem;
    }
}
