/* ===========================================================
   public.css — تنسيقات الواجهة العامة (المتجر قبل تسجيل الدخول)
   منفصل تماماً عن admin.css.
   =========================================================== */

@import url('tajawal-font.css');

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

html {
    font-size: 16px;
    color-scheme: light;
}

body {
    font-family: 'Tajawal', 'Segoe UI Arabic', Tahoma, sans-serif;
    background: #f7f9fc;
    color: #1f2d3d;
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #1e88e5;
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: #0d62b8;
}

img {
    max-width: 100%;
    display: block;
}

/* ===== Header ===== */
.public-header {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.public-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1a3d5c;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
}

.brand-link:hover {
    color: #1a3d5c;
}

.brand-dot {
    color: #1e88e5;
    font-size: 1.4rem;
    line-height: 1;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 0.95rem;
}

.public-nav a {
    color: #475569;
}

.public-nav a:hover {
    color: #1a3d5c;
}

.public-nav .login-cta {
    padding: 8px 18px;
    background: #1e88e5;
    color: #fff;
    border-radius: 6px;
    font-weight: 500;
}

.public-nav .login-cta:hover {
    background: #1565c0;
    color: #fff;
}

/* ===== Main ===== */
.public-main {
    flex: 1;
    width: 100%;
}

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, #1a3d5c 0%, #2563eb 100%);
    color: #fff;
    padding: 60px 20px;
    text-align: center;
}

.hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.92;
}

/* ===== Generic content section ===== */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.content-narrow {
    max-width: 900px;
}

.section-title {
    font-size: 1.5rem;
    color: #1a3d5c;
    margin-bottom: 24px;
    text-align: center;
}

/* ===== Empty state ===== */
.public-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7c8c;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
    font-size: 0.9rem;
    color: #6b7c8c;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.breadcrumbs a {
    color: #6b7c8c;
}

.breadcrumbs a:hover {
    color: #1e88e5;
}

.breadcrumbs .sep {
    color: #cbd5e1;
}

.breadcrumbs .current {
    color: #1f2d3d;
    font-weight: 500;
}

/* ===== Cards grid (categories + services) ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.10);
}

.card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #f1f4f8;
}

.card-image-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
}

.card-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a3d5c;
    margin-bottom: 8px;
}

.card-meta {
    font-size: 0.88rem;
    color: #6b7c8c;
    margin-bottom: 8px;
}

.card-text {
    font-size: 0.92rem;
    color: #475569;
    flex: 1;
    margin-bottom: 14px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #1e88e5;
    color: #fff;
    border-radius: 6px;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 500;
    align-self: stretch;
}

.card-btn:hover {
    background: #1565c0;
    color: #fff;
}

.card-btn-secondary {
    background: #fff;
    color: #1e88e5;
    border: 1px solid #1e88e5;
}

.card-btn-secondary:hover {
    background: #f0f7ff;
    color: #1565c0;
}

/* ===== Service detail page ===== */
.service-detail {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.service-hero-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 22px;
}

.service-hero-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 3rem;
    margin-bottom: 22px;
}

.service-detail h1 {
    font-size: 1.8rem;
    color: #1a3d5c;
    margin-bottom: 8px;
}

.service-short {
    color: #475569;
    font-size: 1.05rem;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

/* HTML content rendered from full_description (Summernote) */
.service-description {
    color: #1f2d3d;
    line-height: 1.8;
    margin-bottom: 28px;
}

.service-description h1,
.service-description h2,
.service-description h3,
.service-description h4 {
    color: #1a3d5c;
    margin-top: 18px;
    margin-bottom: 10px;
}

.service-description h2 { font-size: 1.4rem; }
.service-description h3 { font-size: 1.2rem; }
.service-description h4 { font-size: 1.05rem; }

.service-description p {
    margin-bottom: 12px;
}

.service-description ul,
.service-description ol {
    margin-right: 24px;
    margin-bottom: 12px;
}

.service-description li {
    margin-bottom: 4px;
}

.service-description a {
    color: #1e88e5;
    text-decoration: underline;
}

.service-description blockquote {
    margin: 14px 0;
    padding: 10px 16px;
    border-right: 4px solid #1e88e5;
    background: #f0f7ff;
    color: #475569;
}

.service-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
}

.service-description th,
.service-description td {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    text-align: right;
}

.service-description th {
    background: #f8fafc;
    font-weight: 600;
}

/* CTA block on service page (login prompt) */
.login-prompt {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 22px;
    text-align: center;
}

.login-prompt p {
    color: #1e3a8a;
    font-size: 1.05rem;
    margin-bottom: 14px;
}

.login-prompt .login-prompt-btn {
    display: inline-block;
    padding: 10px 28px;
    background: #1e88e5;
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
}

.login-prompt .login-prompt-btn:hover {
    background: #1565c0;
    color: #fff;
}

/* ===== Footer ===== */
.public-footer {
    background: #1a3d5c;
    color: #cbd9e6;
    padding: 28px 20px;
    margin-top: 40px;
}

.public-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.92rem;
}

.public-footer .footer-brand strong {
    color: #fff;
    font-size: 1.05rem;
}

.public-footer .footer-contact {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.public-footer a {
    color: #cbd9e6;
}

.public-footer a:hover {
    color: #fff;
}

.ltr {
    direction: ltr;
    display: inline-block;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .hero h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero {
        padding: 40px 16px;
    }
    .content {
        padding: 28px 16px;
    }
}

@media (max-width: 480px) {
    .public-header-inner {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }
    .public-nav {
        gap: 12px;
        font-size: 0.9rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 1.5rem;
    }
    .hero p {
        font-size: 0.98rem;
    }
    .service-detail {
        padding: 18px;
    }
    .service-detail h1 {
        font-size: 1.5rem;
    }
    .public-footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* ===========================================================
   Phase 6 — صفحات المصادقة العامة (login, forgot, verify)
   تعمل داخل layout الواجهة العامة (public-header/footer).
   =========================================================== */

.login-card-public {
    background: #fff;
    border-radius: 12px;
    padding: 36px 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    max-width: 480px;
    margin: 40px auto;
}

.login-card-public h1 {
    text-align: center;
    color: #1a3d5c;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.login-card-public .login-subtitle {
    text-align: center;
    color: #6b7c8c;
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.login-form-public {
    margin-bottom: 18px;
}

.login-field {
    display: block;
    margin-bottom: 16px;
}

.login-label {
    display: block;
    color: #334155;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.login-form-public input[type="text"],
.login-form-public input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.05rem;
    color: #1f2d3d;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* خاص بحقل الكود — letter-spacing وlatin direction للقراءة الأفضل */
.login-form-public input[name$="_code"],
.login-form-public input[name="verification_code"] {
    text-align: center;
    letter-spacing: 0.15em;
    direction: ltr;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 1.15rem;
}

.login-form-public input:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

.login-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #1e88e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.login-btn:hover {
    background: #1565c0;
}

/* رسائل (تنبيهات) داخل بطاقة الدخول */
.login-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.login-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-right: 4px solid #ef4444;
}

.login-alert-success {
    background: #f0fdf4;
    color: #166534;
    border-right: 4px solid #22c55e;
}

.login-alert-info {
    background: #eff6ff;
    color: #1e3a8a;
    border-right: 4px solid #3b82f6;
}

.login-alert a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* روابط مساعدة أسفل البطاقة (نسيت الكود، دخول الموظف، إلخ) */
.login-links {
    text-align: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.92rem;
    color: #475569;
}

.login-links a {
    color: #1e88e5;
    margin: 0 4px;
}

.login-links a:hover {
    color: #0d62b8;
}

.login-links .sep {
    color: #cbd5e1;
    margin: 0 4px;
}

/* تحسينات الموبايل */
@media (max-width: 480px) {
    .login-card-public {
        padding: 26px 20px;
        margin: 20px auto;
    }
    .login-card-public h1 {
        font-size: 1.3rem;
    }
}

/* ===========================================================
   Phase 7 — السلة والـ checkout والأسعار في كروت/تفاصيل الخدمة
   =========================================================== */

/* رابط السلة في الهيدر */
.public-nav .cart-link {
    color: #1a3d5c;
    background: #f1f4f8;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.public-nav .cart-link:hover {
    background: #e2e8f0;
    color: #0d62b8;
}

/* السعر داخل بطاقة الخدمة في صفحة الفئة */
.card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e88e5;
    margin: 4px 0 12px;
}

/* بلوك السعر + زر السلة في صفحة تفاصيل الخدمة */
.service-price-block {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: #f0f7ff;
    border-radius: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.service-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e88e5;
    flex: 1;
    min-width: 140px;
}

.add-to-cart-form {
    margin: 0;
}

.cart-status-badge {
    color: #166534;
    font-weight: 600;
    background: #dcfce7;
    padding: 6px 12px;
    border-radius: 6px;
}

/* جدول السلة */
.cart-table-wrap {
    background: #fff;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 18px;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th,
.cart-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.cart-table thead {
    background: #f8fafc;
}

.cart-table th {
    color: #475569;
    font-weight: 600;
    font-size: 0.92rem;
}

.cart-table tfoot th,
.cart-table tfoot td {
    background: #f8fafc;
    font-size: 1.05rem;
    border-top: 2px solid #e2e8f0;
    border-bottom: none;
}

.cart-item-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.cart-thumb-placeholder {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.4rem;
}

.cart-item-name {
    color: #1a3d5c;
    font-weight: 500;
    text-decoration: none;
}

.cart-item-name:hover {
    color: #1e88e5;
}

.cart-price-cell {
    direction: ltr;
    text-align: left;
    font-variant-numeric: tabular-nums;
    color: #1f2d3d;
    font-weight: 500;
    white-space: nowrap;
}

.cart-total {
    color: #1e88e5;
    font-weight: 700;
    font-size: 1.1rem;
}

.cart-inline-form {
    display: inline-block;
    margin: 0;
}

.cart-btn-remove {
    padding: 6px 14px;
    background: #fff;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.cart-btn-remove:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

/* أزرار أسفل السلة (إفراغ + متابعة) */
.cart-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.cart-btn-primary {
    display: inline-block;
    padding: 11px 24px;
    background: #1e88e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.cart-btn-primary:hover {
    background: #1565c0;
    color: #fff;
}

/* مودِفاير للأزرار التي تحتوي أيقونة + نص (مثل «إضافة للسلة») */
.cart-btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cart-btn-with-icon .cart-btn-icon {
    flex-shrink: 0;
}

.cart-btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    background: #fff;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}

.cart-btn-secondary:hover {
    background: #f1f5f9;
    color: #1a3d5c;
}

/* بطاقة ملخّص الـ checkout */
.checkout-summary-card {
    background: #fff;
    border-radius: 10px;
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.checkout-summary-card .panel-title {
    font-size: 1.1rem;
    color: #1a3d5c;
    margin-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.checkout-form {
    background: #fff;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.checkout-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.checkout-form textarea:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

/* بطاقة نجاح الطلب */
.checkout-success-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 28px;
    text-align: center;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    max-width: 560px;
    margin: 40px auto;
}

.checkout-success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: #16a34a;
    color: #fff;
    border-radius: 50%;
    font-size: 2.5rem;
    line-height: 72px;
    font-weight: 700;
}

.checkout-success-card h1 {
    color: #1a3d5c;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.checkout-success-card .muted {
    color: #6b7c8c;
    margin-bottom: 6px;
}

.checkout-order-number {
    display: inline-block;
    margin: 4px 0 18px;
    padding: 10px 20px;
    background: #1a3d5c;
    color: #fff;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.2rem;
    direction: ltr;
}

.checkout-success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 18px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .cart-table th,
    .cart-table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
    .cart-thumb {
        width: 40px;
        height: 40px;
    }
    .service-price {
        font-size: 1.3rem;
    }
    .cart-actions {
        flex-direction: column-reverse;
    }
    .cart-btn-primary,
    .cart-btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* ===========================================================
   قائمة المستخدم المنسدلة في الهيدر (المسجَّلين فقط)
   =========================================================== */
.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #475569;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.user-menu-toggle:hover,
.user-menu-toggle[aria-expanded="true"] {
    background: #f1f4f8;
    border-color: #e2e8f0;
    color: #1a3d5c;
}

.user-menu-icon {
    flex-shrink: 0;
    color: #1e88e5;
}

.user-menu-greeting {
    white-space: nowrap;
}

.user-menu-greeting strong {
    color: #1a3d5c;
    font-weight: 700;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    /* RTL: المحاذاة من اليمين كي تنفتح القائمة تحت الزر مباشرة */
    right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    padding: 6px 0;
    z-index: 1000;
    overflow: hidden;
}

.user-menu-dropdown[hidden] {
    display: none;
}

.user-menu-info {
    padding: 10px 14px;
    color: #475569;
    font-size: 0.88rem;
    border-bottom: 1px solid #f1f5f9;
    line-height: 1.5;
    cursor: default;
    direction: rtl;
}

.user-menu-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #b91c1c;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.user-menu-logout:hover,
.user-menu-logout:focus {
    background: #fef2f2;
    color: #991b1b;
    outline: none;
}

.user-menu-logout svg {
    flex-shrink: 0;
}

/* الموبايل: القائمة بعرض كامل تقريباً */
@media (max-width: 480px) {
    .user-menu-greeting {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .user-menu-dropdown {
        min-width: 220px;
    }
}
