/* ============================================
   PAGES — Dashboard, Orders, Schedule, etc.
   ============================================ */

/* --- SECTIONS --- */
.section { margin-bottom: 36px; }

.section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

/* --- STATS GRID --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon {
    font-size: 18px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-100);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.stat-info { flex: 1; }

.stat-info h3,
.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-family: 'DM Sans', sans-serif;
}

.stat-info p,
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- ORDER CARDS (dashboard) --- */
.orders-list { display: grid; gap: 12px; }

.order-card {
    background: var(--bg-card);
    padding: 18px 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
}

.order-card:hover {
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-dark);
    color: var(--text-primary);
}

.order-card.highlight {
    border-left-color: var(--success);
    background: var(--success-light);
}

.order-info h3 {
    font-size: 16px;
    margin-bottom: 2px;
    font-weight: 600;
}

.order-number { color: var(--text-muted); font-size: 13px; }

.order-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.order-date { font-size: 13px; color: var(--text-secondary); }

.order-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    font-family: 'DM Sans', sans-serif;
}

/* --- ORDER DETAIL & FORM --- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.info-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.info-card h3 {
    margin-bottom: 14px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
}

.info-card p {
    margin-bottom: 8px;
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-secondary);
}

.info-card .large {
    font-size: 18px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Order form layout */
.order-form-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.preview-section { position: sticky; top: 32px; }

.preview-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    overflow: hidden;
}

.preview-card h3 {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    background: var(--cream-dark);
}

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

.preview-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}

.preview-table td {
    padding: 8px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

.preview-totals { padding: 16px 20px; border-top: 1px solid var(--border); }

.preview-totals .total-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.preview-totals .total-final {
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 16px;
    color: var(--text-primary);
}

/* Items table */
.items-table { width: 100%; border-collapse: collapse; }

.items-table th,
.items-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.items-table thead { background: var(--cream-dark); }

.items-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.total-row { background: var(--bg-hover); font-weight: 700; }
.total-row td { padding: 14px; }

.price-display { display: flex; flex-direction: column; gap: 2px; }
.price-without-vat { font-size: 12px; color: var(--text-muted); }
.price-with-vat { font-size: 15px; font-weight: 700; color: var(--primary); }

/* Item row (order form) */
.item-row {
    display: grid;
    grid-template-columns: 1fr 80px auto 140px 36px;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}

/* item-name-wrapper takes full width of its cell */
.item-row .item-name-wrapper { min-width: 0; }

/* qty input */
.item-row .item-qty { min-width: 0; width: 100%; }

/* unit badge */
.item-row .item-unit-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 600;
    background: var(--cream-dark);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    text-align: center;
}

/* price input */
.item-row .item-price { min-width: 0; width: 100%; }

.btn-remove {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.current-image img {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* --- SCHEDULE --- */
.week-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.week-label {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    min-width: 200px;
    text-align: center;
}

.schedule-table {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.day-header { background: var(--cream-dark) !important; font-weight: 600; }

.day-header.today {
    background: var(--primary-100) !important;
    border-left: 3px solid var(--primary);
}

.day-header td { padding: 12px 16px !important; font-size: 14px; }

.schedule-row td { padding: 8px 12px !important; }

.schedule-row .form-control { padding: 8px 10px; font-size: 13px; }

.add-employee,
.remove-employee {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.add-employee {
    background: var(--primary);
    color: white;
}

.add-employee:hover { background: var(--primary-dark); }

.remove-employee {
    background: var(--danger);
    color: white;
}

.remove-employee:hover { background: #963028; }

/* --- SIHTERICA --- */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.employee-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: var(--transition);
}

.employee-card:hover { box-shadow: var(--shadow-md); }

.employee-card.inactive { opacity: 0.55; border-style: dashed; }

.employee-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.employee-header h3 {
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 600;
}

.employee-rate { color: var(--text-muted); font-size: 13px; }

.employee-stats { margin: 12px 0; }

.employee-stats .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.employee-stats .stat-label { color: var(--text-secondary); font-size: 13px; }

.employee-stats .stat-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.employee-stats .stat-value.highlight {
    color: var(--primary);
    font-size: 15px;
}

.employee-actions { margin-top: 14px; }

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

/* Hours table */
.hours-table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
}

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

.hours-table thead {
    background: var(--primary);
    color: white;
}

.hours-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.hours-table tbody tr { border-bottom: 1px solid var(--border-light); }
.hours-table tbody tr:hover { background: var(--bg-hover); }

.hours-table tbody tr.today {
    background: var(--primary-50);
    border-left: 3px solid var(--primary);
}

.hours-table tbody tr.weekend { background: var(--cream-dark); }

.hours-table td { padding: 8px 14px; }

.day-label {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    background: var(--cream-dark);
    color: var(--text-secondary);
}

.day-label.weekend {
    background: var(--warning-light);
    color: var(--warning);
}

.hours-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-input);
}

.hours-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(139, 94, 60, 0.12);
}

.notes-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    background: var(--bg-input);
}

.notes-input:focus {
    border-color: var(--primary);
    outline: none;
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-month {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    min-width: 140px;
    text-align: center;
}

/* --- NOTES --- */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.note-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    border-left: 3px solid;
    transition: var(--transition);
}

.note-card:hover { box-shadow: var(--shadow-md); }

.note-yellow { border-left-color: #C4922A; }
.note-blue   { border-left-color: #5B85C2; }
.note-green  { border-left-color: #5A7A4A; }
.note-red    { border-left-color: #B84A3C; }
.note-purple { border-left-color: #7C5C9A; }

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.note-header h3 { font-size: 16px; flex: 1; font-weight: 600; }

.note-actions { display: flex; gap: 6px; }

.note-content {
    margin-bottom: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 14px;
}

.note-footer { color: var(--text-muted); font-size: 12px; }

.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-picker label { cursor: pointer; }
.color-picker input { display: none; }

.color-box {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: var(--transition);
    display: inline-block;
}

.color-picker input:checked + .color-box {
    border-color: var(--text-primary);
    transform: scale(1.15);
    box-shadow: var(--shadow-sm);
}

.bg-yellow { background: #C4922A; }
.bg-blue   { background: #5B85C2; }
.bg-green  { background: #5A7A4A; }
.bg-red    { background: #B84A3C; }
.bg-purple { background: #7C5C9A; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .order-form-layout { grid-template-columns: 1fr; }
    .preview-section { position: static; }
    .order-card { flex-direction: column; align-items: flex-start; gap: 12px; }
    .order-details { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
    .info-grid,
    .stats-grid { grid-template-columns: 1fr; }
    .notes-grid,
    .employees-grid { grid-template-columns: 1fr; }
    .week-navigation { flex-direction: column; align-items: stretch; }
    .month-selector { flex-direction: column; }
    .current-month { min-width: auto; }
    .item-row { grid-template-columns: 1fr 0.7fr auto; }
    .item-row .item-price { grid-column: 1 / -1; }
    .item-row .item-name-wrapper { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
    .main-content { padding: 16px 12px; }
    .order-price { font-size: 16px; }
}