/* سیستم ناهار مدرسه - Design System مطابق App.tsx */

/* متغیرهای رنگی مطابق globals.css */
:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --radius: 0.625rem;
}

/* فونت و تنظیمات پایه */
.school-lunch-container {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif !important;
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    background: var(--background);
    color: var(--foreground);
}

.school-lunch-container * {
    box-sizing: border-box;
}

/* کلاس‌های مطابق shadcn/ui */
.school-lunch-message {
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.school-lunch-message.success {
    background: hsl(120 60% 95%);
    color: hsl(120 60% 25%);
    border-color: hsl(120 60% 85%);
}

.school-lunch-message.error {
    background: var(--destructive);
    color: var(--primary-foreground);
    border-color: var(--destructive);
}

/* صفحه ورود مطابق shadcn Card */
.student-login-wrapper {
    min-height: 100vh;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--card);
    color: var(--card-foreground);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
}

.school-header {
    text-align: center;
    margin-bottom: 30px;
}

.school-logo {
    width: 60px;
    height: 60px;
    background: #1976d2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 24px;
}

.school-title {
    color: #1565c0;
    font-size: 28px;
    margin-bottom: 5px;
    margin-top: 0;
}

.school-subtitle {
    color: #1976d2;
    font-size: 16px;
    margin: 0;
}

/* فرم‌ها مطابق shadcn Input & Button */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--foreground);
    font-weight: 500;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    background: var(--background);
    color: var(--foreground);
}

.form-input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--ring);
}

.login-button {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: inherit;
    height: 40px;
}

.login-button:hover:not(:disabled) {
    background: hsl(from var(--primary) h s calc(l * 0.9));
}

.login-button:disabled {
    background: var(--muted);
    color: var(--muted-foreground);
    cursor: not-allowed;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-right: 4px solid #c62828;
}

.demo-info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 14px;
}

.demo-info h4 {
    color: #1565c0;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 16px;
}

/* صفحه ورود ادمین */
.admin-theme .student-login-wrapper,
.admin-login-wrapper {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
}

.admin-card {
    border-top: 4px solid #7b1fa2;
}

.admin-header .admin-logo {
    background: #7b1fa2;
}

.admin-title {
    color: #4a148c;
}

.admin-subtitle {
    color: #7b1fa2;
}

.admin-button {
    background: #7b1fa2;
}

.admin-button:hover {
    background: #6a1b9a;
}

.admin-info {
    background: #f3e5f5;
}

.security-note {
    background: #fff8e1;
    border: 2px solid #ffcc02;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.security-icon {
    font-size: 18px;
    margin-top: 2px;
}

.security-text {
    color: #ef6c00;
    font-size: 13px;
    line-height: 1.4;
}

/* صفحه سفارش ناهار */
.welcome-header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.student-info h2 {
    color: #1976d2;
    margin: 0 0 5px 0;
    font-size: 24px;
}

.student-info p {
    color: #666;
    margin: 0;
}

.logout-btn {
    background: #f44336;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background: #d32f2f;
    color: white;
}

.lunch-ordering-wrapper {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: #1976d2;
    color: white;
    padding: 20px;
    text-align: center;
}

.card-header h3 {
    margin: 0 0 5px 0;
    font-size: 22px;
}

.card-header p {
    margin: 0;
    opacity: 0.9;
}

.menu-sections {
    padding: 20px;
}

.menu-section {
    margin-bottom: 30px;
}

.section-title {
    background: #f5f5f5;
    padding: 12px 20px;
    margin: 0 0 15px 0;
    border-radius: 8px;
    color: #333;
    font-size: 18px;
    border-right: 4px solid #1976d2;
}

.menu-items {
    display: grid;
    gap: 15px;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.menu-item:hover {
    border-color: #1976d2;
}

.item-info h5 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
}

.item-info p {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 14px;
}

.price {
    color: #1976d2;
    font-weight: 600;
    font-size: 14px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.qty-btn {
    width: 35px;
    height: 35px;
    border: 2px solid #1976d2;
    background: white;
    color: #1976d2;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.qty-btn:hover {
    background: #1976d2;
    color: white;
}

.qty-input {
    width: 50px;
    height: 35px;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
}

/* خلاصه سفارش */
.order-summary {
    background: #f8f9fa;
    border-top: 3px solid #1976d2;
    padding: 20px;
}

.summary-header h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.order-item {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
}

.order-item:last-child {
    border-bottom: none;
}

.no-items {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

.total-price {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    font-size: 18px;
    color: #1976d2;
}

.submit-order-btn {
    width: 100%;
    padding: 15px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: inherit;
}

.submit-order-btn:hover:not(:disabled) {
    background: #45a049;
}

.submit-order-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* پنل مدیریت */
.admin-dashboard {
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.dashboard-header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-info h2 {
    color: #7b1fa2;
    margin: 0 0 5px 0;
    font-size: 24px;
}

.admin-info p {
    color: #666;
    margin: 0;
}

.filters-section {
    margin-bottom: 20px;
}

.filter-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-filter label {
    font-weight: 600;
    color: #333;
}

.date-filter input[type="date"] {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-family: inherit;
}

/* آمار */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    font-size: 40px;
    width: 60px;
    text-align: center;
}

.stat-info h3 {
    margin: 0 0 5px 0;
    font-size: 28px;
    color: #333;
}

.stat-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* جدول سفارشات */
.orders-section {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section-header {
    background: #7b1fa2;
    color: white;
    padding: 20px;
}

.section-header h3 {
    margin: 0;
    font-size: 20px;
}

.no-orders {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-orders-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.no-orders h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
}

.no-orders p {
    margin: 0;
    font-size: 14px;
}

.orders-table-wrapper {
    overflow-x: auto;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.orders-table th,
.orders-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #e0e0e0;
}

.orders-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.orders-table tr:hover {
    background: #f8f9fa;
}

.order-items {
    max-width: 200px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 13px;
}

.quantity {
    color: #666;
    font-weight: 600;
}

.price {
    font-weight: 600;
    color: #1976d2;
}

.status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background: #d1ecf1;
    color: #0c5460;
}

.status-preparing {
    background: #d4edda;
    color: #155724;
}

.status-ready {
    background: #cff4fc;
    color: #055160;
}

.status-delivered {
    background: #d1e7dd;
    color: #0f5132;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

/* Modal مطابق shadcn Dialog */
.modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: hsl(0 0% 0% / 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card);
    color: var(--card-foreground);
    padding: 0;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border: 1px solid var(--border);
}

.modal-header {
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-foreground);
    font-size: 18px;
    font-weight: 600;
}

.close {
    font-size: 20px;
    cursor: pointer;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
    color: var(--primary-foreground);
}

.close:hover {
    background-color: rgba(255,255,255,0.2);
}

.modal-form {
    padding: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--background);
    color: var(--foreground);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px var(--ring);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.button {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid var(--border);
    font-family: inherit;
}

.button-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.button-primary:hover {
    background: hsl(from var(--primary) h s calc(l * 0.9));
}

.button-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}

.button-secondary:hover {
    background: var(--muted);
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .school-lunch-container {
        padding: 10px;
    }
    
    .welcome-header,
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .menu-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
    }
    
    .orders-table {
        font-size: 12px;
    }
    
    .orders-table th,
    .orders-table td {
        padding: 8px 4px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}