/* ============================================
   ImobiSISMAX - Estilos Globais
   Tema Liquid Glass | Dark & Light Mode
   ============================================ */

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

/* ============================================
   CSS CUSTOM PROPERTIES (Variáveis de Tema)
   ============================================ */
:root {
    /* Light Mode (default) */
    --bg-base: #f0f2f5;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --bg-glass-strong: rgba(255, 255, 255, 0.8);
    --bg-sidebar: rgba(255, 255, 255, 0.5);
    --bg-header: rgba(255, 255, 255, 0.6);
    --bg-input: rgba(255, 255, 255, 0.8);

    --border-glass: rgba(0, 0, 0, 0.08);
    --border-glass-strong: rgba(0, 0, 0, 0.12);
    --border-input: rgba(0, 0, 0, 0.15);

    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-inverse: #ffffff;

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glass-sm: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-glass-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(34, 197, 94, 0.15);

    --blur-glass: 20px;
    --blur-glass-strong: 40px;

    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-light: rgba(34, 197, 94, 0.1);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);

    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
.dark {
    --bg-base: #0a0f1a;
    --bg-surface: rgba(255, 255, 255, 0.05);
    --bg-surface-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-strong: rgba(255, 255, 255, 0.07);
    --bg-sidebar: rgba(255, 255, 255, 0.03);
    --bg-header: rgba(10, 15, 26, 0.8);
    --bg-input: rgba(255, 255, 255, 0.06);

    --border-glass: rgba(255, 255, 255, 0.06);
    --border-glass-strong: rgba(255, 255, 255, 0.1);
    --border-input: rgba(255, 255, 255, 0.12);

    --text-primary: #e7e9ea;
    --text-secondary: #a0aec0;
    --text-muted: #71767b;
    --text-inverse: #0a0f1a;

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glass-sm: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-glass-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(34, 197, 94, 0.2);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    transition: var(--transition);
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* ============================================
   GLASS COMPONENTS
   ============================================ */

/* Card Glass */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}

.glass-card:hover {
    background: var(--bg-surface-hover);
    box-shadow: var(--shadow-glass-lg);
    border-color: var(--border-glass-strong);
}

/* Sidebar Glass */
.glass-sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(var(--blur-glass-strong));
    -webkit-backdrop-filter: blur(var(--blur-glass-strong));
    border-right: 1px solid var(--border-glass);
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Header Glass */
.glass-header {
    background: var(--bg-header);
    backdrop-filter: blur(var(--blur-glass-strong));
    -webkit-backdrop-filter: blur(var(--blur-glass-strong));
    border-bottom: 1px solid var(--border-glass);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 30;
    transition: var(--transition);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--header-height) + 24px);
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 24px;
    min-height: 100vh;
    transition: var(--transition);
}

/* ============================================
   INPUTS GLASS
   ============================================ */
.input-glass {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.input-glass::placeholder {
    color: var(--text-muted);
}

.input-glass:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-glass-sm);
    background: var(--bg-glass-strong);
}

.input-glass:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Input Label */
.input-label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

/* Input Group (label + input + error) */
.input-group {
    margin-bottom: 20px;
}

.input-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-surface-hover);
    border-color: var(--border-glass-strong);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */
.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card .stat-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card .stat-info .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon-green { background: var(--accent-light); color: var(--accent); }
.stat-icon-red { background: var(--danger-light); color: var(--danger); }
.stat-icon-blue { background: var(--info-light); color: var(--info); }
.stat-icon-yellow { background: var(--warning-light); color: var(--warning); }

/* ============================================
   TABLE GLASS
   ============================================ */
.table-glass {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-glass thead th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
}

.table-glass tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

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

.table-glass tbody tr:hover {
    background: var(--bg-surface-hover);
}

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

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.badge-success {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot-green { background: var(--accent); }
.badge-dot-red { background: var(--danger); }
.badge-dot-yellow { background: var(--warning); }
.badge-dot-blue { background: var(--info); }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-glass-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-success { background: rgba(34, 197, 94, 0.9); }
.toast-error { background: rgba(239, 68, 68, 0.9); }
.toast-warning { background: rgba(245, 158, 11, 0.9); color: #1a1a2e; }
.toast-info { background: rgba(59, 130, 246, 0.9); }

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur-glass-strong));
    -webkit-backdrop-filter: blur(var(--blur-glass-strong));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glass-lg);
    max-width: 560px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    animation: scaleIn 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

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

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-glass);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============================================
   SIDEBAR MENU
   ============================================ */
.sidebar-logo {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-logo img {
    width: 32px;
    height: 32px;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo .logo-accent {
    color: var(--accent);
}

.sidebar-nav {
    padding: 16px 12px;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 12px 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.sidebar-link:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-link .link-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    border-top: 1px solid var(--border-glass);
}

/* ============================================
   HEADER
   ============================================ */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}

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

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

.header-search {
    position: relative;
}

.header-search input {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 8px 16px 8px 40px;
    color: var(--text-primary);
    font-size: 14px;
    width: 280px;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    width: 320px;
}

.header-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--accent);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover {
    box-shadow: var(--shadow-glow);
}

/* ============================================
   HAMBURGER (Mobile)
   ============================================ */
.hamburger {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    justify-content: center;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.pagination a {
    color: var(--text-secondary);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
}

.pagination a:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.pagination .active {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-glass);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   SCROLLBAR CUSTOMIZADA
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-glass-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   PAGE TITLE
   ============================================ */
.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: -16px;
    margin-bottom: 24px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .glass-sidebar {
        transform: translateX(-100%);
    }

    .glass-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-glass-lg);
    }

    .glass-header {
        left: 0;
    }

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

    .hamburger {
        display: flex;
    }

    .header-search input {
        width: 200px;
    }

    .header-search input:focus {
        width: 240px;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .header-search {
        display: none;
    }

    .page-title {
        font-size: 24px;
    }
}

/* ============================================
   BACKDROP MOBILE OVERLAY
   ============================================ */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
}

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