/* style.css - طراحی مدرن و حرفه‌ای */

/* ========== تنظیمات پایه ========== */
:root {
    --primary: #0f4c5f;
    --primary-dark: #0a3a48;
    --primary-light: #1e6f86;
    --secondary: #ff8c42;
    --secondary-dark: #e67e22;
    --accent: #2ecc71;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --gray: #95a5a6;
    --white: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --shadow-xl: 0 12px 48px rgba(0,0,0,0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(145deg, #f0f9ff 0%, #e6f4fa 100%);
    min-height: 100vh;
    direction: rtl;
    color: var(--dark);
    overflow-x: hidden;
}

/* ========== انیمیشن‌ها ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.6s ease forwards;
}

/* ========== بخش هدر ========== */
.top-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #2c8aa8 100%);
    color: var(--white);
    text-align: center;
    padding: 20px 20px 35px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.top-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.top-section h1 {
    font-size: 32px;
    font-weight: 800;
    margin: 15px 0 8px;
    position: relative;
    z-index: 2;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-section h2 {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

/* ========== لینک‌های ادمین ========== */
.admin-links {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 12px;
    z-index: 10;
}

.admin-btn {
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    text-decoration: none;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.admin-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ========== دکمه اصلی ========== */
.main-calc-button {
    margin: 15px auto 0;
    text-align: center;
    position: relative;
    z-index: 5;
}

.main-calc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--secondary) 0%, #ffaa5e 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: 20px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(255, 140, 66, 0.4);
    border: none;
    cursor: pointer;
}

.main-calc-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 32px rgba(255, 140, 66, 0.5);
}

.date-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.date-display {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 10px 24px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.3);
}

.refresh-date-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-date-btn:hover {
    background: white;
    color: var(--secondary);
    transform: rotate(180deg);
}

/* ========== بخش ماشین حساب ========== */
.calculator-section {
    max-width: 1000px;
    margin: 35px auto;
    padding: 30px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.calculator-section h2 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 28px;
    font-size: 26px;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

.calculator-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: 3px;
}

/* ========== فرم ========== */
#insuranceForm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.form-group label.required::after {
    content: "*";
    color: var(--danger);
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid #e0e7ed;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    background: var(--white);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-light);
    outline: none;
    box-shadow: 0 0 0 3px rgba(31, 110, 134, 0.1);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--primary-light);
}

/* ========== دکمه محاسبه ========== */
.calc-button {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 15px;
}

.calc-button button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 16px 48px;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 6px 20px rgba(15, 76, 95, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.calc-button button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 76, 95, 0.4);
}

.calc-button button:active {
    transform: translateY(0);
}

/* ========== بخش نتیجه ========== */
#result {
    margin-top: 35px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 25px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(31, 110, 134, 0.2);
    box-shadow: var(--shadow-md);
}

#result h3 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* باکس‌های نتیجه */
.result-box-white,
.result-box-red,
.result-box-green,
.result-box-yellow,
.result-box-light-yellow {
    padding: 22px 20px;
    border-radius: var(--radius-md);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-box-white {
    background: linear-gradient(135deg, #ffffff 0%, #fefefe 100%);
    border: 1px solid rgba(31, 110, 134, 0.2);
    box-shadow: var(--shadow-sm);
}

.result-box-red {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.3);
}

.result-box-green {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(46, 204, 113, 0.3);
}

.result-box-yellow {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: #2c3e50;
    box-shadow: 0 8px 20px rgba(241, 196, 15, 0.3);
}

.result-box-light-yellow {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3d6 100%);
    border: 1px solid #f1c40f;
    color: #2c3e50;
}

.result-label {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 12px;
    display: block;
    letter-spacing: 0.3px;
}

.result-value {
    font-size: 32px;
    font-weight: 800;
    direction: ltr;
    display: block;
    letter-spacing: 1px;
}

.result-box-white .result-value {
    color: var(--primary-dark);
    font-size: 36px;
}

.result-box-green .result-value,
.result-box-red .result-value {
    font-size: 28px;
}

.result-note {
    text-align: center;
    font-size: 13px;
    color: var(--gray);
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
    font-style: italic;
}

/* ========== اطلاعات انتخاب شده ========== */
.selected-info {
    background: linear-gradient(135deg, #f8fdfe 0%, #f0f9fc 100%);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-top: 35px;
    border: 1px solid rgba(31, 110, 134, 0.15);
}

.selected-info h4 {
    color: var(--primary);
    margin-bottom: 18px;
    font-size: 18px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.selected-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.selected-item {
    background: var(--white);
    padding: 14px;
    border-radius: var(--radius-sm);
    border-right: 3px solid var(--secondary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.selected-item:hover {
    transform: translateX(-3px);
    box-shadow: var(--shadow-md);
}

.selected-item strong {
    color: var(--primary-dark);
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

.selected-value {
    font-weight: 700;
    font-size: 15px;
    color: var(--dark);
}

/* ========== سابقه خسارت ========== */
.damage-history {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.damage-item {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--white);
    transition: all 0.2s ease;
}

.damage-label {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 8px;
    font-weight: 500;
}

/* استایل خسارت - قرمز برای خسارت */
.damage-value.has-damage {
    color: #c62828 !important;
    font-weight: 700;
    background: #ffebee;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.damage-value.no-damage {
    color: #2e7d32 !important;
    background: #e8f5e9;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

/* استایل تخفیف‌ها */
.discount-positive {
    background: #e8f5e9;
    color: #2e7d32;
    border-right: 3px solid #4caf50;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
}

.discount-negative {
    background: #ffebee;
    color: #c62828;
    border-right: 3px solid #f44336;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
}

.discount-neutral {
    background: #f5f5f5;
    color: #757575;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

/* ========== پیام خطا ========== */
.error-box {
    background: #fff5f5;
    color: var(--danger);
    padding: 14px 20px;
    margin: 20px auto;
    border-radius: var(--radius-sm);
    text-align: center;
    border-right: 4px solid var(--danger);
    max-width: 900px;
    box-shadow: var(--shadow-sm);
}

.error-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* ========== کانتینر تاریخ ========== */
.date-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-input-container input {
    flex: 1;
}

.date-input-container button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.date-input-container button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ========== سود شما ========== */
.savings-text {
    font-size: 14px;
    color: var(--secondary-dark);
    margin-top: 10px;
    font-weight: 600;
    display: inline-block;
    background: rgba(255, 140, 66, 0.1);
    padding: 6px 14px;
    border-radius: 30px;
}

/* ========== رسپانسیو ========== */
@media (max-width: 768px) {
    .top-section {
        padding: 15px 15px 25px;
    }
    
    .top-section h1 {
        font-size: 24px;
    }
    
    .admin-links {
        position: static;
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .calculator-section {
        margin: 20px 15px;
        padding: 20px;
    }
    
    .calculator-section h2 {
        font-size: 20px;
    }
    
    #insuranceForm {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .damage-history {
        flex-direction: column;
        gap: 10px;
    }
    
    .date-container {
        flex-direction: column;
    }
    
    .result-value {
        font-size: 24px;
    }
    
    .result-box-white .result-value {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .top-section h1 {
        font-size: 20px;
    }
    
    .top-section h2 {
        font-size: 13px;
    }
    
    .main-calc-btn {
        font-size: 16px;
        padding: 12px 24px;
    }
    
    .calculator-section h2 {
        font-size: 18px;
    }
    
    .result-value {
        font-size: 20px;
    }
    
    .result-box-white .result-value {
        font-size: 24px;
    }
    
    .selected-details {
        grid-template-columns: 1fr;
    }
}

/* ========== چاپ ========== */
@media print {
    .top-section, .admin-links, .calc-button, .refresh-date-btn, .main-calc-button {
        display: none;
    }
    
    .calculator-section {
        box-shadow: none;
        margin: 0;
        padding: 10px;
    }
    
    #result {
        border: 1px solid #ccc;
    }
}