/* ==================================================
   Tailor Shop Management System
   Shared Persian/Dari RTL Styles
================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Tahoma, Arial, sans-serif;
    background: #f3f6f9;
    color: #222;
    direction: rtl;
}

a {
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-title {
    color: #1874c9;
    margin: 0 0 18px;
    text-align: center;
    font-size: 24px;
}

.en {
    direction: ltr;
    unicode-bidi: embed;
    color: #666;
    font-size: 12px;
}

/* ==================================================
   Top Navigation
================================================== */

.topbar {
    background: #1874c9;
    color: white;
    padding: 12px 20px;
    margin-bottom: 20px;
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-title {
    font-size: 20px;
    font-weight: bold;
}

.topbar-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.topbar-links a {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.topbar-links a:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==================================================
   Cards
================================================== */

.card {
    background: white;
    border: 1px solid #d8e2ef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.card-title {
    color: #1874c9;
    font-size: 17px;
    font-weight: bold;
    margin: 0 0 12px;
}

/* ==================================================
   Buttons
================================================== */

.btn {
    display: inline-block;
    background: #1874c9;
    color: white;
    border: none;
    padding: 9px 15px;
    border-radius: 7px;
    font-size: 14px;
    font-family: Tahoma, Arial, sans-serif;
    cursor: pointer;
    text-align: center;
}

.btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #555;
}

.btn-success {
    background: #16803c;
}

.btn-danger {
    background: #b91c1c;
}

.btn-warning {
    background: #b7791f;
}

.btn-sm {
    padding: 5px 9px;
    font-size: 12px;
}

/* ==================================================
   Forms
================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.form-group {
    min-width: 0;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

input,
select,
textarea {
    width: 100%;
    padding: 9px;
    border: 1px solid #b9c5d3;
    border-radius: 6px;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 14px;
    background: white;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #1874c9;
    box-shadow: 0 0 0 2px rgba(24, 116, 201, 0.12);
}

.form-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================================================
   Search Box
================================================== */

.search-box {
    background: #eef6ff;
    border: 1px solid #cfe7ff;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto auto;
    gap: 10px;
    align-items: end;
}

/* ==================================================
   Tables
================================================== */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    border: 1px solid #d8e2ef;
    padding: 8px;
    text-align: right;
    font-size: 13px;
    vertical-align: middle;
}

th {
    background: #1874c9;
    color: white;
    font-weight: bold;
}

tr:nth-child(even) {
    background: #f9fbfd;
}

td.actions {
    white-space: nowrap;
}

td.actions a,
td.actions button {
    margin: 2px;
}

/* ==================================================
   Dashboard Cards
================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    background: white;
    border: 1px solid #d8e2ef;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.stat-label {
    color: #666;
    font-size: 13px;
    margin-bottom: 6px;
}

.stat-value {
    color: #1874c9;
    font-size: 23px;
    font-weight: bold;
}

/* ==================================================
   Status Badges
================================================== */

.status-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-completed {
    background: #d1ecf1;
    color: #0c5460;
}

.status-submitted {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* ==================================================
   Alerts
================================================== */

.alert {
    padding: 10px 12px;
    border-radius: 7px;
    margin-bottom: 14px;
    font-weight: bold;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* ==================================================
   Logo
================================================== */

.shop-logo,
.logo-preview,
.empty-logo {
    width: 64px;
    height: 64px;
    border: 2px solid #1874c9;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.logo-preview {
    width: 90px;
    height: 90px;
}

.empty-logo {
    background:
        linear-gradient(135deg, transparent 47%, #d8e2ef 48%, #d8e2ef 52%, transparent 53%),
        linear-gradient(45deg, transparent 47%, #d8e2ef 48%, #d8e2ef 52%, transparent 53%),
        #ffffff;
}

/* ==================================================
   Exact Tailor Order Form Style
================================================== */

.order-form {
    font-size: 14px;
    direction: rtl;
}

.order-card {
    background: white;
    border: 1px solid #d8e2ef;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.order-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.order-header-info {
    flex: 1;
    text-align: right;
}

.order-shop-name {
    font-size: 23px;
    font-weight: bold;
    color: #1874c9;
    margin: 0;
}

.order-shop-en {
    font-size: 13px;
    color: #555;
    margin: 4px 0 0;
}

.order-shop-address {
    font-size: 12px;
    color: #666;
    margin: 3px 0 0;
}

.order-grid {
    display: grid;
    gap: 7px;
}

.order-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.order-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.order-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.order-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.ofield {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ofield-label {
    font-size: 12px;
    font-weight: bold;
    color: #1874c9;
    padding: 5px 7px;
    background: #eaf4ff;
    border-radius: 7px 7px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ofield-input {
    background: #f7f9fb;
    min-height: 32px;
    border-radius: 0 0 7px 7px;
    border: 1px solid #edf1f5;
    border-top: none;
    display: flex;
    align-items: center;
}

.ofield-input input,
.ofield-input select,
.ofield-input textarea {
    width: 100%;
    height: 32px;
    border: none;
    background: transparent;
    padding: 5px 8px;
    box-sizing: border-box;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 13px;
    outline: none;
}

.ofield-input textarea {
    min-height: 70px;
    resize: vertical;
}

.ofield-value {
    background: #f7f9fb;
    min-height: 32px;
    border-radius: 0 0 7px 7px;
    border: 1px solid #edf1f5;
    border-top: none;
    padding: 7px 8px;
    font-weight: bold;
    color: #111;
    overflow-wrap: anywhere;
}

.order-section-title {
    color: #1874c9;
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 8px;
}

.order-note-box {
    background: #f7f9fb;
    border: 1px solid #edf1f5;
    border-radius: 8px;
    padding: 8px;
}

/* ==================================================
   Print Helpers
================================================== */

.print-toolbar {
    text-align: center;
    margin: 10px 0;
}

@media print {
    body {
        background: white;
    }

    .print-toolbar,
    .topbar,
    .no-print {
        display: none !important;
    }

    .card,
    .order-card,
    .stat-card {
        box-shadow: none;
    }
}

/* ==================================================
   Responsive
================================================== */

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-grid {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .form-grid-3,
    .form-grid-4,
    .order-grid-2,
    .order-grid-3,
    .order-grid-4,
    .order-grid-5 {
        grid-template-columns: 1fr;
    }

    .topbar-inner {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .topbar-links {
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .container {
        padding: 12px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .order-header {
        flex-direction: column;
        text-align: center;
    }

    .order-header-info {
        text-align: center;
    }
}