/* ============================================================
   ROOM CLEAN & CHECKLIST PRO - DESIGN SYSTEM & STYLES
   ============================================================ */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #64748b;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffaff;

    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   FLEXBOX & ALIGNMENT UTILITY CLASSES
   ============================================================ */
.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.items-center {
    align-items: center;
}
.justify-center {
    justify-content: center;
}
.justify-between {
    justify-content: space-between;
}
.min-h-screen {
    min-height: 100vh;
}
.text-center {
    text-align: center;
}
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}
.w-full {
    width: 100%;
}
.max-w-md {
    max-width: 440px;
}
.max-w-lg {
    max-width: 540px;
}
.space-y-4 > * + * {
    margin-top: 1rem;
}
.space-y-2 > * + * {
    margin-top: 0.5rem;
}

/* ============================================================
   LAYOUT COMPONENTS (SIDEBAR & HEADER)
   ============================================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    background: #0f172a;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 40;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #1e293b;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-link:hover, .sidebar-link.active {
    color: #ffffff;
    background: #1e293b;
    border-left: 4px solid var(--primary);
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #090d16;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 35;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    width: calc(100% - 260px);
    max-width: 100%;
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.25rem 1rem;
    }
    .mobile-stack {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================
   HEADER & NAVBAR
   ============================================================ */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    gap: 1rem;
}

.mobile-toggle {
    display: none;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    font-size: 1.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-main);
    line-height: 1;
}

@media (max-width: 992px) {
    .mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .navbar {
        flex-wrap: wrap;
        padding: 0.875rem 1rem;
    }
    .navbar h1 {
        font-size: 1.2rem !important;
    }
}

/* ============================================================
   CARDS & CONTAINERS
   ============================================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
    .card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
}

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

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

/* ============================================================
   STAT METRICS GRID
   ============================================================ */

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

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.825rem;
    color: var(--text-muted);
}

/* ============================================================
   BADGES & STATUS INDICATORS
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.badge-livre {
    background: var(--success-light);
    color: #065f46;
}

.badge-em_limpeza, .badge-em_andamento {
    background: var(--warning-light);
    color: #92400e;
}

.badge-concluido {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-agendado {
    background: #f1f5f9;
    color: #475569;
}

.badge-ativo {
    background: var(--success-light);
    color: #065f46;
}

.badge-inativo {
    background: var(--danger-light);
    color: #991b1b;
}

/* ============================================================
   BUTTONS & CONTROLS (TOUCH-FRIENDLY)
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 44px;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

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

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: #ffffff;
}

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    min-height: 36px;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1.05rem;
    min-height: 52px;
}

/* ============================================================
   TABLES (RESPONSIVE TOUCH SCROLLING)
   ============================================================ */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
    min-width: 640px;
}

.table th {
    background: #f1f5f9;
    padding: 0.75rem 0.875rem;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* ============================================================
   FORMS & INPUTS (PREVENT AUTO-ZOOM ON MOBILE)
   ============================================================ */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--info-light);
    color: #155e75;
    border: 1px solid #a5f3fc;
}

/* ============================================================
   CAMAREIRA MOBILE OPERATIONAL CHECKLIST
   ============================================================ */

.checklist-item-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    padding: 1.125rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.checklist-item-card.completed {
    border-color: var(--success);
    background: #f0fdf4;
}

.checklist-header {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.checklist-checkbox {
    width: 26px;
    height: 26px;
    accent-color: var(--success);
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.checklist-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.checklist-desc {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.camera-upload-zone {
    margin-top: 0.875rem;
    padding: 1rem;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.camera-upload-zone:hover, .camera-upload-zone:active {
    background: #f1f5f9;
    border-color: var(--primary);
}

.photo-preview {
    max-width: 100%;
    max-height: 220px;
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
    object-fit: cover;
    display: none;
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   DONO & ADMIN PHOTO GALLERY (RESPONSIVE CSS GRID)
   ============================================================ */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    .gallery-thumb {
        height: 140px !important;
    }
}

.gallery-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.gallery-thumb {
    width: 100%;
    height: 170px;
    object-fit: cover;
    cursor: pointer;
    display: block;
    background: #e2e8f0;
}

.gallery-body {
    padding: 0.75rem;
}

.gallery-item-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    line-height: 1.3;
}

/* ============================================================
   LIGHTBOX MODAL
   ============================================================ */

.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

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

.lightbox-content {
    max-width: 95vw;
    max-height: 80vh;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    color: #ffffff;
    font-size: 2.2rem;
    cursor: pointer;
    font-weight: 300;
    line-height: 1;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: var(--danger);
}

.lightbox-caption {
    position: absolute;
    bottom: 1.5rem;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.75);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    max-width: 90vw;
    text-align: center;
}
