/* ============================================
   Yükleme Yönetim Sistemi - Loading Management System
   Main Stylesheet - Light Theme
   ============================================ */

/* CSS Variables - Design System (Light Theme) */
:root {
    /* Colors */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --secondary: #0284c7;
    --secondary-dark: #0369a1;
    --accent: #f59e0b;
    --success: #059669;
    --success-dark: #047857;
    --warning: #d97706;
    --danger: #dc2626;
    --danger-dark: #b91c1c;

    /* Light Theme Neutrals */
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-400: #6b7280;
    --gray-500: #9ca3af;
    --gray-600: #d1d5db;
    --gray-700: #e5e7eb;
    --gray-800: #f3f4f6;
    --gray-900: #f9fafb;

    /* Light Theme Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
    --gradient-light: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.2);

    /* Typography */
    --font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    direction: ltr;
    line-height: 1.6;
}

/* Utility Classes */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.hidden {
    display: none !important;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #536dfe 0%, #7e57c2 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.1), transparent 60%);
    pointer-events: none;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.login-logo {
    margin-bottom: 40px;
}

.login-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #536dfe 0%, #7e57c2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
    color: white;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
}

.login-logo p {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s, background 0.2s;
    border: 1px solid transparent;
}

.input-group:focus-within {
    background: #ffffff;
    border-color: #7e57c2;
    box-shadow: 0 0 0 4px rgba(126, 87, 194, 0.1);
}

.input-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 20px;
}

.input-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.input-content label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 2px;
    display: block;
    text-align: left;
    width: 100%;
}

.input-content input {
    background: transparent;
    border: none;
    padding: 0;
    width: 100%;
    font-size: 14px;
    color: #334155;
    font-weight: 500;
    outline: none;
    font-family: inherit;
}

.input-content input::placeholder {
    color: #94a3b8;
}

.login-btn {
    margin-top: 16px;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #536dfe 0%, #7e57c2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #ef4444;
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    text-align: left;
}

.login-error.show {
    display: block;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

/* Global Layout Fixes */
.header-content,
.main-content {
    max-width: 1200px;
    /* Unified width */
    margin: 0 auto;
    /* Center */
    padding-left: 20px !important;
    padding-right: 20px !important;
    width: 100%;
    box-sizing: border-box;
}

/* Restore Header Flex Layout */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-title span {
    font-size: 13px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.header-user-info span {
    display: block;
}

.header-user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.header-user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-btn {
    padding: 10px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    color: #dc2626;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.dashboard {
    width: 100%;
    overflow-x: hidden;
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-card {
    width: 100%;
    margin-bottom: 24px;
    padding: 24px !important;
    /* Unified padding */
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.form-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.form-card-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.form-card-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-card-title p {
    font-size: 14px;
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    gap: 20px;
}

.form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.form-group {
    display: flex;
    flex-direction: column;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    padding: 14px 16px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Validation Styles */
input:required,
select:required,
textarea:required,
.products-table-file-input select:required {
    border-color: #ef4444;
    /* Red border for mandatory fields */
}

input:required:valid,
select:required:valid,
textarea:required:valid {
    border-color: #10b981;
    /* Green border when filled */
}

input:required:focus,
select:required:focus,
textarea:required:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
    /* Red glow on focus */
}

input:required:valid:focus,
select:required:valid:focus,
textarea:required:valid:focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    /* Green glow on focus */
    border-color: #10b981;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.file-upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.file-upload-text {
    color: var(--text-muted);
    font-size: 14px;
}

.file-upload-text span {
    color: var(--primary);
    font-weight: 500;
}

.file-upload-input {
    display: none;
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.file-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-remove {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Products Table */
.products-table-container {
    overflow-x: auto;
    margin-top: 16px;
}

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

.products-table th,
.products-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.products-table th {
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.products-table td {
    background: var(--bg-card);
}

.products-table input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
}

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

/* Explicit Validation for Table Inputs */
.products-table input:required {
    border-color: #ef4444 !important;
    /* Force red border for required fields */
}

.products-table input:required:valid {
    border-color: #10b981 !important;
    /* Force green border when filled */
}

.products-table input:required:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.products-table input:required:valid:focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.add-row-btn {
    margin-top: 16px;
    padding: 12px 24px;
    background: rgba(5, 150, 105, 0.1);
    border: 1px solid rgba(5, 150, 105, 0.3);
    border-radius: var(--radius);
    color: #059669;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-row-btn:hover {
    background: rgba(5, 150, 105, 0.15);
}

.remove-row-btn {
    padding: 8px 12px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius-sm);
    color: #dc2626;
    cursor: pointer;
    transition: var(--transition);
}

.remove-row-btn:hover {
    background: rgba(220, 38, 38, 0.15);
}

/* Critical Layout Fix for Tables and Inputs */
.products-table-container {
    width: 100%;
    margin-top: 0;
    display: block;
}

.products-table {
    width: 100%;
    table-layout: fixed;
    /* Enforce column widths */
    border-collapse: separate;
    border-spacing: 0 8px;
}

.products-table-file-input {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.products-table-file-input:hover {
    border-color: var(--primary);
}

.products-table td {
    padding: 8px;
    vertical-align: middle;
    background: var(--bg-card);
}

/* Enforce box-sizing on all inputs */
input,
select,
textarea,
.form-group {
    width: 100% !important;
    box-sizing: border-box;
}

/* Ensure table container fills width */
/* Submit Button Redesign */
.submit-section {
    padding: 0;
    margin-top: 32px;
    margin-bottom: 48px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.submit-btn {
    width: 100%;
    padding: 20px;
    background: var(--gradient-success);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2), 0 2px 4px -1px rgba(16, 185, 129, 0.1);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3), 0 4px 6px -2px rgba(16, 185, 129, 0.15);
    filter: brightness(1.05);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn span:last-child {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.submit-btn:hover span:last-child {
    transform: translateX(4px) rotate(-10deg);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(16, 185, 129, 0.3);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   MANAGER DASHBOARD
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.primary {
    background: var(--gradient-primary);
}

.stat-icon.success {
    background: var(--gradient-success);
}

.stat-icon.secondary {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Loadings Table */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.refresh-btn {
    padding: 10px 20px;
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.3);
    border-radius: var(--radius);
    color: #4f46e5;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    background: rgba(79, 70, 229, 0.15);
}

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

.loadings-table th,
.loadings-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.loadings-table th {
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.loadings-table tbody tr {
    transition: var(--transition);
}

.loadings-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.05);
}

.loadings-table td {
    color: var(--text-primary);
    font-size: 14px;
}

.view-btn {
    padding: 8px 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.view-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--transition);
    box-shadow: var(--shadow-xl);
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 20px 24px;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius);
    color: #dc2626;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(220, 38, 38, 0.15);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.detail-section {
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 16px;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-item span {
    font-size: 15px;
    color: var(--text-primary);
}

.detail-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.detail-photo {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.detail-photo:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.detail-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Success Message */
.success-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    /* Start slightly off but use opacity */
    background: var(--gradient-success);
    padding: 16px 32px;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    /* Higher z-index */
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    margin-top: -100px;
    /* Pull it up initially */
}

.success-message.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-top: 0;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
    }

    .form-card {
        padding: 20px;
    }

    .modal {
        width: 95%;
    }
}

/* ============================================
   STATUS BADGES & RECORD BUTTON
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.status-recorded {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.3);
}

.status-badge.status-pending {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
    border: 1px solid rgba(217, 119, 6, 0.3);
}

.status-badge.large {
    padding: 10px 20px;
    font-size: 16px;
}

.record-section {
    text-align: center;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.05) 0%, var(--bg-input) 100%);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.record-btn {
    padding: 16px 48px;
    background: var(--gradient-success);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.record-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(16, 185, 129, 0.4);
}

.record-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.record-hint {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

.recorded-status {
    padding: 20px;
}

.recorded-info {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 12px;
}

.unrecord-btn {
    padding: 10px 24px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius);
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.unrecord-btn:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.4);
}

.unrecord-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================
   TIME PICKER STYLES
   ============================================ */

.time-picker-wrapper {
    position: relative;
    z-index: 100;
}

.time-picker-wrapper:focus-within {
    z-index: 999;
}

.time-picker {
    position: relative;
}

.time-picker-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.time-picker-display:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.time-icon {
    font-size: 20px;
}

.time-value {
    flex: 1;
    color: var(--text-muted);
    font-size: 15px;
}

.time-value.has-value {
    color: var(--text-primary);
    font-weight: 500;
}

.time-arrow {
    color: var(--text-muted);
    font-size: 12px;
    transition: var(--transition);
}

.time-picker-dropdown.show~.time-picker-display .time-arrow,
.time-picker-display:focus .time-arrow {
    transform: rotate(180deg);
}

.time-picker-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
}

.time-picker-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.time-picker-columns {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.time-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.time-column-label {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.time-scroll {
    height: 200px;
    overflow-y: auto;
    background: var(--bg-input);
    border-radius: var(--radius);
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.time-scroll::-webkit-scrollbar {
    width: 6px;
}

.time-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.time-scroll::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.time-option {
    padding: 10px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-radius: var(--radius-sm);
    margin: 2px 4px;
}

.time-option:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--text-primary);
}

.time-option.selected {
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.time-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    padding: 0 8px;
}

.time-confirm-btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.time-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.time-confirm-btn:active {
    transform: translateY(0);
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 12px 4px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}


/* ============================================
   VERSION HISTORY UI
   ============================================ */

.version-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    scrollbar-width: thin;
}

.version-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.version-tab:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
}

.version-tab.active {
    background: white;
    color: var(--primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.version-content {
    /* Container for the details content */
}

.archive-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #b45309;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.new-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 12px;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    /* Base Page Setup */
    @page {
        margin: 15mm;
        size: A4 portrait;
    }

    /* Hide Everything by Default */
    body> :not(.modal-overlay) {
        display: none !important;
    }

    /* Hide Non-Printable Elements */
    .header,
    .stats-grid,
    .filters-card,
    .loadings-table td:nth-child(9),
    .view-btn,
    .modal-close,
    .modal-actions,
    .logout-btn,
    .refresh-btn,
    .record-section,
    .record-hint,
    .tab-btn,
    .version-tabs,
    .archive-warning {
        display: none !important;
    }

    /* Print Reset for Body & HTML */
    html,
    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100% !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color: black !important;
        font-family: 'Inter', sans-serif !important;
        display: block !important;
        /* Ensure no flex/grid on body */
    }

    /* Modal Reset */
    .modal-overlay {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        display: block !important;
        overflow: visible !important;
        z-index: 10 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .modal {
        position: relative !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        max-height: none !important;
        height: auto !important;
        display: block !important;
        overflow: visible !important;
    }

    .modal-header h2 {
        font-size: 24px !important;
        text-align: center;
        margin-bottom: 20px;
        color: black !important;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }

    .modal-body {
        overflow: visible !important;
        padding: 0 !important;
        max-height: none !important;
    }

    /* Section Styling */
    .detail-section {
        border-top: 2px solid #333 !important;
        border-bottom: none !important;
        border-left: none !important;
        border-right: none !important;
        border-radius: 0 !important;
        margin-top: 25px !important;
        margin-bottom: 25px !important;
        padding: 20px 0 0 0 !important;
        box-shadow: none !important;
        background: white !important;
        break-inside: avoid;
        /* Prevent splitting across pages */
    }

    .detail-section h3 {
        font-size: 18px !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
        margin-bottom: 16px !important;
        color: black !important;
        font-weight: bold !important;
    }

    /* Print Images 4x Larger */
    .existing-photos-container,
    .detail-section>div>div[style*="aspect-ratio"] {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 20px !important;
        grid-template-columns: none !important;
    }

    .edit-photo-item,
    .detail-section>div>div[style*="aspect-ratio"] {
        width: 320px !important;
        height: 320px !important;
        aspect-ratio: auto !important;
        border: 2px solid #ddd !important;
        box-shadow: none !important;
    }

    .edit-photo-item img,
    .detail-section>div>div[style*="aspect-ratio"] img {
        width: 320px !important;
        height: 320px !important;
        object-fit: cover !important;
    }

    /* Hide edit/delete buttons on photos */
    .edit-photo-item button,
    .detail-section>div>div[style*="aspect-ratio"] button {
        display: none !important;
    }

    /* Grid Layout for Print */
    .detail-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 columns for better density */
        gap: 12px !important;
    }

    .detail-item {
        margin-bottom: 0 !important;
    }

    .detail-item label {
        font-weight: 600 !important;
        color: #666 !important;
        font-size: 11px !important;
        text-transform: uppercase;
        margin-bottom: 2px;
    }

    .detail-item span {
        font-size: 13px !important;
        color: black !important;
        font-weight: 500;
    }

    /* Remove highlight borders in print */
    .field-changed,
    .detail-item.field-changed {
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }

    /* Table Styling for Print */
    .products-table {
        border: 1px solid #ddd !important;
        width: 100% !important;
    }

    .products-table th {
        background-color: #f8f9fa !important;
        color: black !important;
        font-weight: bold;
        border: 1px solid #ddd;
        padding: 8px;
    }

    .products-table td {
        border: 1px solid #ddd;
        padding: 8px;
        color: black !important;
    }

    /* Force Table Header to Repeat on New Pages (Browser support varies) */
    thead {
        display: table-header-group;
    }

    tr {
        break-inside: avoid;
    }
}

/* ============================================
   Custom Popup System (Toast + Confirm Dialog)
   ============================================ */

/* Toast Container */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    max-width: 400px;
    pointer-events: all;
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    font-family: var(--font-family);
}

.toast.hide {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-msg {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Toast variants */
.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--accent);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

/* Confirm Dialog Overlay */
#confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

#confirm-overlay.show {
    opacity: 1;
    pointer-events: all;
}

#confirm-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 30px 28px 24px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    transform: scale(0.9) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: var(--font-family);
}

#confirm-overlay.show #confirm-box {
    transform: scale(1) translateY(0);
}

#confirm-icon {
    font-size: 44px;
    margin-bottom: 14px;
    display: block;
}

#confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#confirm-cancel-btn {
    flex: 1;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

#confirm-cancel-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

#confirm-ok-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--danger);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

#confirm-ok-btn:hover {
    background: var(--danger-dark);
}

#confirm-ok-btn.ok-primary {
    background: var(--primary);
}

#confirm-ok-btn.ok-primary:hover {
    background: var(--primary-dark);
}

#confirm-ok-btn.ok-success {
    background: var(--success);
}

#confirm-ok-btn.ok-success:hover {
    background: var(--success-dark);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(60px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(60px) scale(0.9);
    }
}