/* assets/css/main.css */

/* =========================================
   لود فونت محلی (Local Fonts)
========================================= */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../../../resources/assets-temp/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../../resources/assets-temp/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../../resources/assets-temp/fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../../resources/assets-temp/fonts/Vazirmatn-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}


/* =========================================
   متغیرها و تنظیمات پایه
========================================= */
:root {
    --primary: #FF7500;
    --primary-light: #FFF0E5;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --accent: #0088cc;
    --accent-light: #e5f3fa;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    height: 100vh;
    font-size: 14px;
    overflow: hidden; /* مدیریت اسکرول توسط main-content */
}

body.login-body {
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   المان‌های مشترک (هدر، محتوا، دکمه‌ها)
========================================= */
.header {
    background-color: var(--card-bg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
}

.header h1 {
    font-size: 16px;
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.header .logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 12px;
    margin-left: 12px;
    color: var(--text-dark);
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.back-btn:active {
    background: #e2e8f0;
}

.back-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transform: rotate(180deg); /* مخصوص قالب راست‌چین RTL */
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.user-avatar svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.main-content {
    padding: 24px 20px;
    overflow-y: auto;
    flex: 1;
    padding-bottom: 100px;
}

.bottom-action {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: var(--card-bg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    z-index: 20;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

.btn-submit {
    width: 100%;
    background: linear-gradient(135deg, #FF8C00 0%, #E65100 100%);
    color: white;
    border: none;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(255, 117, 0, 0.2);
    transition: transform 0.1s;
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   صفحه اصلی (Index) و دسته‌بندی بیمه‌ها
========================================= */
.welcome-banner {
    background: linear-gradient(135deg, #FF8C00 0%, #E65100 100%);
    border-radius: 24px;
    padding: 28px 24px;
    color: white;
    margin-bottom: 32px;
    box-shadow: 0 12px 24px rgba(255, 117, 0, 0.25);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.welcome-banner h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.welcome-banner p {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.6;
    position: relative;
    z-index: 2;
    font-weight: 300;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* شبکه فشرده (۳ ستونه) برای صفحه اصلی */
.services-grid.compact-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.service-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: transform 0.2s;
}

.service-card:active {
    transform: scale(0.98);
}

.services-grid.compact-grid .service-card {
    padding: 16px 8px;
    border-radius: 16px;
}

.icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.services-grid.compact-grid .icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    margin-bottom: 10px;
}

.icon-wrapper svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.services-grid.compact-grid .icon-wrapper svg {
    width: 24px;
    height: 24px;
}

.service-card span {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.services-grid.compact-grid .service-card span {
    font-size: 11px;
    text-align: center;
    line-height: 1.4;
}

.service-card small {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* رنگ‌بندی آیکون‌های دسته‌بندی بیمه */
.icon-wrapper.third-party { background-color: var(--primary-light); color: var(--primary); }
.icon-wrapper.body-ins { background-color: var(--accent-light); color: var(--accent); }
.icon-wrapper.motorcycle { background-color: #f1f5f9; color: #475569; }
.icon-wrapper.life { background-color: #fdf2f8; color: #e11d48; }
.icon-wrapper.fire { background-color: #fef2f2; color: #ef4444; }
.icon-wrapper.building-liability { background-color: #ecfdf5; color: #10b981; }
.icon-wrapper.elevator { background-color: #eef2ff; color: #4f46e5; }
.icon-wrapper.other-ins { background-color: #fffbeb; color: #d97706; }

/* =========================================
   نویگیشن پایین (Bottom Navigation)
========================================= */
.bottom-nav-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 20;
}

.bottom-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(255, 117, 0, 0.08);
    display: flex;
    justify-content: space-around;
    padding: 12px 8px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex: 1;
    padding: 8px 0;
    border-radius: 16px;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 6px;
    fill: currentColor;
    transition: transform 0.2s;
}

.nav-item.active svg {
    transform: translateY(-2px);
}

.nav-item span {
    font-size: 11px;
    font-weight: 700;
}

/* =========================================
   فرم‌ها (مانند فرم استعلام خودرو و بدنه)
========================================= */
.form-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.form-group {
    margin-bottom: 20px;
    text-align: right;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    background-color: #fafbfc;
    color: var(--text-dark);
    transition: all 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 117, 0, 0.1);
    background-color: var(--card-bg);
}

select.form-control {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 16px center;
    background-size: 16px;
    appearance: none;
}

/* =========================================
   صفحه ورود و OTP (Login)
========================================= */
.login-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 10px 30px rgba(255, 117, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.03);
    text-align: center;
}

.logo-box {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--primary);
}

.logo-box svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.login-card h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.login-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.login-card .form-control {
    text-align: center;
    letter-spacing: 2px;
    font-size: 16px;
    direction: ltr;
}

.error-msg {
    color: #dc2626;
    font-size: 12px;
    margin-top: 8px;
    display: none;
    text-align: right;
}

#step2 {
    display: none;
}

.change-number {
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    display: inline-block;
    margin-top: 16px;
    font-weight: bold;
}

/* =========================================
   لیست قیمت‌ها (Tariffs)
========================================= */
.loading-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-state svg {
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    fill: var(--primary);
    margin-bottom: 16px;
}

.company-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.company-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.company-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.company-name {
    font-weight: 800;
    font-size: 15px;
    color: var(--text-dark);
}

.score {
    font-size: 12px;
    color: var(--success);
    font-weight: bold;
    background: #ecfdf5;
    padding: 4px 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.score svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.card-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.details span {
    font-size: 12px;
    color: var(--text-muted);
}

.details strong {
    color: var(--text-dark);
}

.price-section {
    text-align: left;
}

.price {
    font-size: 18px;
    font-weight: 900;
    color: var(--primary);
    display: flex;
    align-items: baseline;
    gap: 4px;
    direction: ltr;
    justify-content: flex-end;
}

.price span {
    font-size: 11px;
    font-weight: normal;
    color: var(--text-muted);
}

.btn-select {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 13px;
    margin-top: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.btn-select:active {
    opacity: 0.8;
}

/* =========================================
   فاکتور، تایید نهایی و پروفایل کاربری (Checkout/Profile)
========================================= */
.invoice-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.02);
    margin-bottom: 20px;
}

.invoice-title {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-dark);
    font-weight: 800;
    font-size: 18px;
}

.invoice-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}

.invoice-row:last-child {
    border-bottom: none;
}

.invoice-row .label {
    color: var(--text-muted);
}

.invoice-row .value {
    font-weight: bold;
    color: var(--text-dark);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0 0;
    margin-top: 10px;
    border-top: 2px solid var(--border-color);
}

.total-row .label {
    font-size: 16px;
    font-weight: 800;
}

.total-row .value {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary);
    direction: ltr;
    display: flex;
    gap: 4px;
    align-items: baseline;
}

.total-row .value span {
    font-size: 12px;
    font-weight: normal;
    color: var(--text-muted);
}

.success-state {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #ecfdf5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin: 0 auto 24px;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    fill: currentColor;
}

.success-state h2 {
    font-size: 20px;
    margin-bottom: 12px;
}

.success-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.tracking-box {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px dashed var(--primary);
    display: inline-block;
    margin: 0 auto;
}

.tracking-box span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.tracking-box strong {
    font-size: 24px;
    color: var(--primary);
    letter-spacing: 2px;
}

.btn-home {
    display: inline-block;
    margin-top: 32px;
    color: var(--primary);
    font-weight: bold;
    border-bottom: 1px dashed var(--primary);
    padding-bottom: 2px;
}



/* =========================================
   Desktop Constraint (Softened Mini-App View)
========================================= */

/* 1. Use a very light, soft background for the desktop to blend better */
html {
    background-color: #f1f5f9;
}

/* 2. Slightly wider container (540px) with a soft border instead of a harsh shadow */
body {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: #f8f9fb;
    /* Replaced the harsh shadow with a subtle 1px border and a nearly invisible, diffuse glow */
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow-x: hidden;
}

/* 3. Match the fixed elements to the new 540px width */
.header,
.hero-header,
.bottom-nav-container,
.bottom-action,
.main-content > div[style*="position: sticky"] {
    max-width: 540px !important;
    margin: 0 auto !important;
    left: 0 !important;
    right: 0 !important;
}

/* =========================================
   Custom Modern Scrollbar
========================================= */

/* For Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* For Chrome, Edge, and Safari */
::-webkit-scrollbar {
    width: 5px; /* Ultra-thin width */
}

::-webkit-scrollbar-track {
    background: transparent; /* Hides the track to keep it clean */
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1; /* A soft, subtle grayish-blue */
    border-radius: 10px; /* Fully rounded edges */
}

::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8; /* Slightly darker when the user hovers over it */
}

/* =========================================
   Agent Panel Utilities
========================================= */
.agent-order-card {
    margin-bottom: 16px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    align-items: center;
}

.status-badge {
    font-size: 11px;
    padding: 4px 8px;
    background-color: #e2e8f0;
    color: #475569;
    border-radius: 4px;
    font-weight: 600;
}

.order-details {
    font-size: 13px;
    margin-bottom: 12px;
    color: #475569;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    margin: 0;
    flex: 1; /* Makes buttons share the row equally */
}

.btn-success {
    background-color: #10b981; /* Tailwind emerald-500 */
}

.btn-success:active {
    background-color: #059669; /* Tailwind emerald-600 */
}