/* سامانه هوشمند رزرو اتوبوس - Main Stylesheet (Mobile-first Responsive) */
:root {
    --primary: #0b4f6c;
    --primary-dark: #083d54;
    --accent: #f4b740;
    --success: #2a9d8f;
    --danger: #e63946;
    --warning: #f4a261;
    --bg: #f4f7fc;
    --card: #ffffff;
    --text: #1e2b3c;
    --muted: #6c8da8;
    --border: #d0e0ef;
    --radius: 16px;
    --shadow: 0 10px 30px -8px rgba(0, 40, 70, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Prevent long unbroken strings from overflowing */
p, span, td, th, li, label, h1, h2, h3, h4, h5, h6, a, div {
    overflow-wrap: break-word;
    word-break: break-word;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
}

/* Header */
.header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--border);
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}

.badge {
    background: #fff8e6;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    color: #9b5f00;
    font-weight: 500;
    border: 1px solid #ffd58c;
    font-size: 0.9rem;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: normal;
    text-align: center;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #21867a;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #c62828;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}
.btn-secondary:hover {
    background: #dde0e4;
}

.btn-cta {
    background: var(--accent);
    color: #13293D;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.9rem 1.6rem;
    border-radius: 50px;
    box-shadow: 0 8px 0 #9e6d1f;
}
.btn-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 0 #9e6d1f;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 36px;
}

/* Landing */
.cta-banner {
    background: linear-gradient(112deg, #13293D, #1c4a6b);
    color: white;
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.cta-banner h2 {
    font-size: 1.4rem;
    line-height: 1.4;
}

.cta-banner p {
    font-size: 1rem;
    opacity: 0.95;
}

.service-tags {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.25rem;
}
.service-tags span {
    background: var(--primary);
    color: white;
    padding: 0.35rem 1.1rem;
    border-radius: 50px;
    font-size: 0.9rem;
}

.question-block {
    background: white;
    padding: 1.25rem;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}
.bubbles span {
    background: #ecf5fb;
    padding: 0.35rem 0.9rem;
    border-radius: 40px;
    font-size: 0.85rem;
    color: #02658b;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1.5rem 0 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.steps-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.step-card {
    background: white;
    padding: 1.25rem 1rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.step-num {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.7rem;
}

.payment-box {
    background: white;
    border-radius: 16px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-right: 6px solid var(--success);
    box-shadow: var(--shadow);
}

.payment-box .highlight {
    font-weight: 700;
    color: #03556b;
    margin-top: 0.5rem;
}

.auth-links {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

/* Cards & Forms */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    max-width: 100%;
    padding: 12px 14px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #fff;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 79, 108, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: auto;
}

.required::after {
    content: " *";
    color: var(--danger);
}

/* Status chips */
.status-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: normal;
    line-height: 1.3;
    max-width: 100%;
}

.status-submitted { background: #e3f2fd; color: #1565c0; }
.status-published_to_companies { background: #e8f5e9; color: #2e7d32; }
.status-quotes_available { background: #fff3e0; color: #ef6c00; }
.status-awaiting_advance_payment { background: #fce4ec; color: #c2185b; }
.status-payment_verified { background: #e8f5e9; color: #1b5e20; }
.status-completed { background: #e0f2f1; color: #00695c; }
.status-rejected { background: #ffebee; color: #c62828; }
.status-selected { background: #e8f5e9; color: #1b5e20; }
.status-quoted { background: #e3f2fd; color: #1565c0; }
.status-not_selected { background: #f5f5f5; color: #616161; }

/* Price highlight */
.advance-amount {
    background: #ffebee;
    color: #c62828;
    font-size: 1.25rem;
    font-weight: 800;
    padding: 0.9rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #ef9a9a;
    margin: 1rem 0;
    overflow-wrap: anywhere;
}

/* Tables - base */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
}

th, td {
    padding: 10px 8px;
    text-align: right;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

th {
    background: #f8f9fa;
    font-weight: 700;
    color: #555;
    font-size: 0.85rem;
}

tr:hover {
    background: #fafbfc;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Utility */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-100 { width: 100%; }

/* ========== RESPONSIVE ========== */

/* Small phones (≤400px) */
@media (max-width: 400px) {
    .container {
        padding: 0.75rem;
    }
    .logo h1 {
        font-size: 1.15rem;
    }
    .cta-banner {
        padding: 1.1rem;
        border-radius: 14px;
    }
    .cta-banner h2 {
        font-size: 1.2rem;
    }
    .btn-cta {
        font-size: 0.95rem;
        padding: 0.75rem 1.2rem;
        width: 100%;
    }
    .card {
        padding: 1rem;
        border-radius: 12px;
    }
    .advance-amount {
        font-size: 1.1rem;
        padding: 0.75rem;
    }
    .section-title {
        font-size: 1.15rem;
    }
    .btn {
        padding: 11px 16px;
        font-size: 0.9rem;
    }
}

/* Phones (≤480px) */
@media (max-width: 480px) {
    .steps-grid {
        grid-template-columns: 1fr;
    }
    .btn-cta {
        font-size: 1rem;
        padding: 0.8rem 1.4rem;
    }
    .header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    .auth-links {
        flex-direction: column;
        align-items: stretch;
    }
    .auth-links .btn {
        width: 100%;
    }
    .service-tags {
        gap: 0.4rem;
    }
    .service-tags span {
        font-size: 0.8rem;
        padding: 0.3rem 0.9rem;
    }
}

/* Large phones / small tablets (≤700px) */
@media (max-width: 700px) {
    .cta-banner {
        flex-direction: column;
        text-align: center;
    }
    .header {
        flex-direction: column;
        gap: 0.9rem;
        text-align: center;
    }
    .steps-grid {
        grid-template-columns: 1fr 1fr;
    }
    .container {
        padding: 1rem;
    }
}

/* Tablets and up */
@media (min-width: 601px) {
    .steps-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    .container {
        padding: 1.5rem;
    }
    .logo h1 {
        font-size: 1.6rem;
    }
    .cta-banner {
        padding: 2rem;
        border-radius: 24px;
    }
    .cta-banner h2 {
        font-size: 1.8rem;
    }
    .card {
        padding: 1.5rem;
    }
}

/* Mobile table card transformation (when data-label is present) */
@media (max-width: 768px) {
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }

    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive tr {
        margin-bottom: 1rem;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        padding: 0.75rem;
        background: #fafafa;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }

    .table-responsive td {
        border: none;
        position: relative;
        padding: 8px 10px 8px 10px;
        padding-right: 42%;
        text-align: left;
        font-size: 0.9rem;
        min-height: 36px;
    }

    .table-responsive td:before {
        content: attr(data-label);
        position: absolute;
        top: 8px;
        right: 10px;
        width: 38%;
        padding-left: 8px;
        font-weight: 700;
        font-size: 0.78rem;
        color: #555;
        white-space: normal;
        text-align: right;
        line-height: 1.3;
    }

    /* Fallback when no data-label */
    .table-responsive td:not([data-label]):before {
        content: none;
    }

    .table-responsive td:not([data-label]) {
        padding-right: 10px;
        text-align: right;
    }
}

/* Extra safety for very narrow screens */
@media (max-width: 360px) {
    body {
        font-size: 0.92rem;
    }
    .btn {
        font-size: 0.88rem;
        padding: 10px 12px;
    }
    .status-chip {
        font-size: 0.72rem;
        padding: 3px 8px;
    }
    .table-responsive td {
        padding-right: 48%;
        font-size: 0.85rem;
    }
    .table-responsive td:before {
        width: 44%;
        font-size: 0.72rem;
    }
}
