/* Global Styles & Variables */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --background-dark: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.7);
    --input-bg: rgba(51, 65, 85, 0.5);
    --border-color: rgba(148, 163, 184, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    --success-color: #10b981;
    --warning-color: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* RTL Support - Switch main font for Arabic */
[dir="rtl"] * {
    font-family: 'Cairo', sans-serif;
}

html[dir="rtl"] {
    font-size: 0.9em;
    /* Reduce Arabic font size slightly */
}



body {
    background-color: var(--background-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 0;
    /* Add padding for mobile/scrolling */
}

/* Background Animation */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.globe-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: #764ba2;
    animation-delay: 0s;
}

.globe-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: #2563eb;
    animation-delay: -5s;
}

.globe-3 {
    top: 40%;
    left: 40%;
    width: 300px;
    height: 300px;
    background: #00f2fe;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(30px, -50px);
    }

    66% {
        transform: translate(-20px, 20px);
    }
}

/* Language Toggle */
.controls-top {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

[dir="rtl"] .controls-top {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Container */
.container {
    width: 100%;
    max-width: 550px;
    /* Slightly narrower for compact look */
    padding: 1.5rem;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Calculator Card */
.calculator-card,
.result-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.input-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.95rem;
}

input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-light);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* RTL Input considerations */
[dir="rtl"] input {
    text-align: right;
}

.error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
}

.calculate-btn,
.save-btn {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 12px;
    background: var(--gradient-1);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.save-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.save-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.calculate-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Results Section - Compacted */
.result-card.hidden {
    display: none;
}

.result-card:not(.hidden) {
    display: block;
    animation: slideUp 0.5s forwards;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card h2 {
    text-align: center;
    margin-bottom: 1.2rem;
    color: var(--text-light);
    font-size: 1.5rem;
}

.total-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 1rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 1.2rem;
}

.total-summary .label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
}

.total-summary .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--success-color);
}

/* Compact Fee List */
.fees-list.compacted .fee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-bottom: 1px solid transparent;
}

.fee-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.highlight-fee {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.fee-name {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.fee-amount {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.95rem;
}

.note-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-style: italic;
    line-height: 1.4;
    padding: 0 0.5rem;
}

footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }

    .container {
        padding: 1rem;
    }

    .total-summary {
        flex-direction: column;
        gap: 0.2rem;
        text-align: center;
    }
}