/* ================================================================
   PMS Hotel - Sistema de Gestão Hoteleira
   Design System - Modern SaaS Style
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1E40AF;
    --primary-light: #3B82F6;
    --primary-dark: #1E3A8A;
    --secondary: #64748B;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    
    --sidebar-bg: #0F172A;
    --sidebar-hover: #1E293B;
    --sidebar-active: #1E40AF;
    --sidebar-text: #94A3B8;
    --sidebar-text-active: #FFFFFF;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    
    --bg-main: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-hover: #F8FAFC;
    
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-white: #FFFFFF;
    
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --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);
    
    --transition: all 0.2s ease;
    --header-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

/* ================================================================
   LAYOUT
   ================================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-x: hidden;
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    color: var(--text-white);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section {
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text);
    opacity: 0.5;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: var(--transition);
    gap: 12px;
    border-radius: 0;
    margin: 1px 8px;
    border-radius: var(--radius);
    font-size: 13.5px;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-white);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--text-white);
}

.nav-item svg, .nav-item i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg, .nav-item.active i {
    opacity: 1;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    position: relative;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    position: relative;
}

.sidebar-user,
.sidebar-user-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    min-width: 0;
    text-decoration: none;
}

.sidebar-user:hover,
.sidebar-user-link:hover { background: var(--sidebar-hover); }

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    color: var(--text-white);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 11px;
}

.sidebar-user-menu {
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    margin-bottom: 4px;
    top: auto;
}

.sidebar.collapsed .sidebar-user-menu {
    left: 100%;
    right: auto;
    bottom: 0;
    margin-left: 8px;
    margin-bottom: 0;
    min-width: 180px;
}

/* Pre-render collapsed state (prevents flash) */
body.sidebar-is-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

body.sidebar-is-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* SIDEBAR COLLAPSE TOGGLE */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: var(--transition);
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--text-white);
}

.sidebar-toggle svg {
    transition: transform 0.3s ease;
}

/* SIDEBAR COLLAPSED STATE */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    justify-content: flex-start;
}

.sidebar.collapsed .sidebar-nav {
    flex: 0 1 auto;
    overflow-y: visible;
}

.sidebar.collapsed .sidebar-brand {
    flex-direction: column;
    padding: 12px 0 8px;
    gap: 6px;
    height: auto;
}

.sidebar.collapsed .sidebar-brand-text {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    margin-left: 0;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-section {
    display: none;
}

.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-item .nav-badge {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
    margin: 2px 8px;
    gap: 0;
    position: relative;
}

.sidebar.collapsed .nav-item svg {
    opacity: 0.8;
}

.sidebar.collapsed .sidebar-footer {
    padding: 8px;
    border-top: none;
    overflow: visible;
}

.sidebar.collapsed .sidebar-user,
.sidebar.collapsed .sidebar-user-link {
    justify-content: center;
    padding: 8px;
    gap: 0;
    flex: none;
}

.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-user-chevron,
.sidebar.collapsed .sidebar-logout-btn span {
    display: none;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: rgba(255,255,255,.5);
    flex-shrink: 0;
    transition: all .15s;
    text-decoration: none;
}
.sidebar-logout-btn:hover {
    background: rgba(239,68,68,.2);
    color: #EF4444;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* Tooltip on collapsed sidebar items */
.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    padding: 6px 12px;
    background: var(--sidebar-bg);
    color: var(--text-white);
    border-radius: var(--radius);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1001;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
}

.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius);
}

.menu-toggle:hover { background: var(--bg-hover); }

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-btn .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.content-area {
    padding: 24px;
}

/* ================================================================
   COMPONENTS
   ================================================================ */

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}


.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-hover);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    transition: var(--transition);
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-info h3 {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    min-height: 32px;
    display: flex;
    align-items: flex-start;
}

.stat-info .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-info .stat-change {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--info-light); color: var(--info); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #EDE9FE; color: #7C3AED; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.5;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 10px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13.5px;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .actions {
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-primary { background: var(--info-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #065F46; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger { background: var(--danger-light); color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-secondary { background: #F1F5F9; color: #475569; }
.badge-dark { background: #1E293B; color: #F8FAFC; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: min(90vh, calc(100dvh - 40px));
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: var(--transition);
    overflow: hidden;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search & Filters */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 9px 12px 9px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card);
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination button {
    min-width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover { background: var(--bg-hover); }
.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Toast / Alerts */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 13px;
    font-weight: 500;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Room Status Grid */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    overflow: visible;
}

.room-card {
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.room-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.room-card.status-livre { border-color: var(--success); background: #F0FDF4; }
.room-card.status-reservado { border-color: var(--info); background: #EFF6FF; }
.room-card.status-pre_reserva { border-color: #F59E0B; background: #FFFBEB; }
.room-card.status-ocupado { border-color: var(--danger); background: #FEF2F2; }
.room-card.status-manutencao { border-color: var(--warning); background: #FFFBEB; }
.room-card.status-bloqueado { border-color: var(--secondary); background: #F8FAFC; }

.room-card .room-number {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.room-card .room-category {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.room-card .room-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    top: 10px;
    right: 10px;
}

.room-card.status-livre .room-status-indicator { background: var(--success); }
.room-card.status-reservado .room-status-indicator { background: var(--info); }
.room-card.status-pre_reserva .room-status-indicator { background: #F59E0B; }
.room-card.status-ocupado .room-status-indicator { background: var(--danger); }
.room-card.status-manutencao .room-status-indicator { background: var(--warning); }

/* Room Actions Popup */
.room-actions-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    padding: 4px;
    z-index: 100;
    min-width: 180px;
    text-align: left;
}

.room-actions-menu.show {
    display: block;
}

.room-actions-menu::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border);
}

.room-actions-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-card);
}

.room-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    border-radius: var(--radius);
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
}

.room-action-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.room-action-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.room-action-item:hover svg {
    opacity: 1;
}

.room-cleaning-badge {
    font-size: 10px;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

/* Charts area */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    position: relative;
}

.chart-card canvas {
    max-height: 250px;
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: 100px repeat(7, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.calendar-cell {
    padding: 8px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    min-height: 50px;
    font-size: 12px;
}

.calendar-cell.header {
    background: var(--bg-hover);
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
}

.calendar-cell.room-label {
    background: var(--bg-hover);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.reservation-bar {
    background: var(--primary-light);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    margin: 1px 0;
}

.reservation-bar.status-confirmada { background: var(--info); }
.reservation-bar.status-hospedado { background: var(--success); }
.reservation-bar.status-pre_reserva { background: var(--warning); }
.reservation-bar.status-cancelada { background: var(--danger); opacity: 0.5; }

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 2500;
    display: none;
    padding: 4px;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Loading */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0F172A 0%, #1E40AF 100%);
}

.login-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-brand {
    text-align: center;
    color: white;
}

.login-brand h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
}

.login-brand p {
    font-size: 16px;
    opacity: 0.8;
}

.login-right {
    width: 480px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-form {
    width: 100%;
    max-width: 360px;
}

.login-form h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-form .login-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}

.login-form .form-control {
    padding: 12px 14px;
    font-size: 14px;
}

.login-form .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .chart-grid {
        grid-template-columns: 1fr;
    }
    
    .login-left { display: none; }
    .login-right { width: 100%; }
}

@media (max-width: 768px) {
    .content-area {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-info .stat-value {
        font-size: 22px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .filter-group {
        flex-wrap: wrap;
    }
    
    .rooms-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .room-card {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-header {
        padding: 0 16px;
    }

    .page-title {
        font-size: 15px;
    }

    .toast {
        min-width: 0;
        width: calc(100vw - 48px);
    }

    .toast-container {
        right: 16px;
        left: 16px;
    }
}

/* Print */
@media print {
    .sidebar, .top-header, .toolbar, .pagination { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0 !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; }
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ============================================================
   PERFIL DO USUÁRIO
   ============================================================ */

.perfil-usuario-container {
    max-width: 760px;
    margin: 0 auto;
}

.perfil-header {
    margin-bottom: 28px;
}

.perfil-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.perfil-header .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.perfil-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.perfil-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.perfil-section h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* --- Avatar section --- */
.avatar-section .avatar-edit-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.avatar-preview {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

.avatar-preview .avatar-img,
.avatar-preview .avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
    background: var(--primary-light, #4F6EF7);
    border: 3px solid var(--border);
}

.avatar-preview .avatar-img {
    display: block;
    border: 3px solid var(--border);
}

.avatar-remove-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #EF4444;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s;
    z-index: 2;
}

.avatar-remove-btn:hover {
    background: #DC2626;
}

.avatar-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avatar-upload .help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* --- Form elements --- */
.perfil-form .perfil-section:last-child {
    margin-bottom: 0;
}

.perfil-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.perfil-form .form-group:last-child {
    margin-bottom: 0;
}

.perfil-form .form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.perfil-form .form-group input {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.perfil-form .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,.12);
}

.perfil-form .form-group input:disabled {
    background: var(--bg-secondary, #F8F9FA);
    color: var(--text-muted);
    cursor: not-allowed;
}

.perfil-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.perfil-form .input-small  { max-width: 120px; }
.perfil-form .input-state  { max-width: 80px; }
.perfil-form .input-cep    { max-width: 150px; }

.form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.perfil-form .help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin: 6px 0 0;
}

/* --- Actions --- */
.perfil-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 4px;
}

/* --- Alerts --- */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    color: #166534;
}

.alert-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.alert .close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: inherit;
    opacity: .6;
    padding: 0;
}

.alert .close:hover { opacity: 1; }

/* --- Responsive --- */
@media (max-width: 640px) {
    .perfil-form .form-row {
        grid-template-columns: 1fr;
    }
    .avatar-section .avatar-edit-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .perfil-form .input-small,
    .perfil-form .input-state,
    .perfil-form .input-cep {
        max-width: 100%;
    }
}
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* ── Late Checkout Bell ─────────────────────── */
@keyframes bell-pulse {
    0%,100% { transform: scale(1); }
    30% { transform: scale(1.25) rotate(-12deg); }
    60% { transform: scale(1.15) rotate(10deg); }
}
.bell-pulse svg { animation: bell-pulse .6s ease; }
