@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #ec4899; /* Vibrant Pink */
    --primary-light: #fbcfe8;
    --primary-dark: #db2777;
    --secondary: #6366f1; /* Indigo */
    --secondary-light: #c7d2fe;
    --success: #10b981; /* Emerald Green */
    --warning: #f59e0b; /* Amber */
    --danger: #ef4444; /* Rose Red */
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--neutral-50);
    color: var(--neutral-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Sidebar Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--neutral-900);
    color: var(--neutral-100);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary);
    border-bottom: 1px solid var(--neutral-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex-grow: 1;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--neutral-600);
    padding: 0.6rem 1rem 0.2rem;
    margin-top: 0.1rem;
    pointer-events: none;
    user-select: none;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 1rem;
    color: var(--neutral-300);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sidebar-item a:hover {
    color: var(--neutral-50);
    background-color: var(--neutral-800);
}

.sidebar-item.active a {
    color: var(--neutral-50);
    background-color: var(--primary);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--neutral-800);
    font-size: 0.85rem;
    color: var(--neutral-300);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-footer .user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-footer .logout-btn {
    color: var(--danger);
    text-decoration: none;
    font-weight: 600;
}

/* Main Content Area */
.main-wrapper {
    margin-left: 260px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    min-width: 0;
}

.top-bar {
    background-color: #fff;
    height: 70px;
    border-bottom: 1px solid var(--neutral-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.top-bar-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.main-content {
    padding: 2rem;
    flex-grow: 1;
    overflow-x: hidden;
    min-width: 0;
}

/* Typography Helpers */
.text-muted { color: var(--neutral-700); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Grid System */
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Cards & Layout panels */
.card {
    background-color: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--neutral-200);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--neutral-800);
}

/* Dashboard Metric Card */
.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-info h4 {
    font-size: 0.875rem;
    color: var(--neutral-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.metric-info p {
    font-size: 2rem;
    font-weight: 800;
    font-family: var(--font-heading);
    line-height: 1;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-size: 1.25rem;
}

.metric-icon.blue { background-color: #dbeafe; color: #1d4ed8; }
.metric-icon.green { background-color: #d1fae5; color: #047857; }
.metric-icon.amber { background-color: #fef3c7; color: #b45309; }

/* Buttons styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: #fff;
    color: var(--neutral-800);
    border-color: var(--neutral-300);
}
.btn-secondary:hover {
    background-color: var(--neutral-100);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background-color: #dc2626;
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}
.btn-success:hover {
    background-color: #059669;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* Forms & inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    color: var(--neutral-800);
}

.form-control, .form-select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-300);
    background-color: #fff;
    color: var(--neutral-900);
    transition: border-color 0.15s ease;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Data Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--neutral-200);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background-color: #fff;
}

.table th {
    background-color: var(--neutral-100);
    color: var(--neutral-700);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--neutral-200);
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--neutral-200);
    font-size: 0.9rem;
    color: var(--neutral-800);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: var(--neutral-50);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    line-height: 1;
}

.badge-pending { background-color: var(--neutral-200); color: var(--neutral-700); }
.badge-in-progress { background-color: #dbeafe; color: #1d4ed8; }
.badge-complete { background-color: #d1fae5; color: #047857; }

.badge-cutting { background-color: #fef3c7; color: #b45309; }
.badge-stitching { background-color: #e0f2fe; color: #0369a1; }
.badge-ready { background-color: #f3e8ff; color: #6b21a8; }
.badge-delivered { background-color: #d1fae5; color: #065f46; }

/* Overdue Flag Indicator */
.badge-overdue {
    background-color: #ffe4e6;
    color: #b91c1c;
    animation: blinker 2s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0.6; }
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--neutral-200);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--success);
    transition: width 0.4s ease;
}

/* Modals / Overlays styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 150;
    padding: 1rem;
}

.modal-backdrop.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--neutral-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--neutral-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--neutral-700);
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--neutral-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Toasts / Flash Banners */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 200;
}

.toast {
    background-color: var(--neutral-900);
    color: #fff;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 250px;
    animation: slideIn 0.3s ease forwards;
}

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

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Login Page Custom Styles */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--neutral-900) 0%, var(--neutral-800) 100%);
    padding: 1.5rem;
}

.login-card {
    background-color: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--neutral-700);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Quick Action Widgets */
.punch-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.punch-timer {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--neutral-800);
    letter-spacing: 0.02em;
}

.punch-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--neutral-700);
}

.punch-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--neutral-300);
}

.punch-status-dot.active {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Photo Gallery Grid */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
}

.photo-gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid var(--neutral-200);
    cursor: pointer;
    position: relative;
}

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

.photo-gallery-item.selected {
    border-color: var(--primary);
}

.photo-gallery-item.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--primary);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* Hours Grid report card */
.hours-cell {
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    text-align: center;
    transition: background-color 0.15s ease;
}

.hours-cell:hover {
    background-color: var(--neutral-100);
}

.hours-cell.manual {
    color: var(--secondary);
    border: 1px dashed var(--secondary-light);
}

/* Settings logo previews */
.logo-preview-box {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-300);
    background-color: var(--neutral-50);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.logo-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Lightbox Preview Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.lightbox-modal.active {
    display: flex;
    opacity: 1;
}
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    object-fit: contain;
    border: 3px solid white;
}
.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    font-weight: bold;
    line-height: 1;
    transition: color 0.15s ease;
}
.lightbox-close:hover {
    color: var(--primary);
}

/* Lightbox Navigation Buttons */
.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    user-select: none;
    z-index: 10000;
}
.lightbox-nav-btn:hover {
    background-color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}
.lightbox-prev-btn {
    left: -60px;
}
.lightbox-next-btn {
    right: -60px;
}

@media (max-width: 768px) {
    .lightbox-prev-btn {
        left: 10px;
        background-color: rgba(15, 23, 42, 0.6);
    }
    .lightbox-next-btn {
        right: 10px;
        background-color: rgba(15, 23, 42, 0.6);
    }
}

/* Responsive Grid layouts */
.grid-2-1 {
    grid-template-columns: 2fr 1fr;
}
.grid-3-1 {
    grid-template-columns: 3fr 1fr;
}

/* Sidebar Toggle Button styling */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--neutral-800);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}
.sidebar-toggle-btn:hover {
    background-color: var(--neutral-100);
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 95;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .grid-2-1, .grid-3-1 {
        grid-template-columns: 1fr;
    }

    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 100;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .top-bar {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }
    
    /* Ensure table-responsive doesn't overflow */
    .table-responsive {
        margin: 0;
    }
}
