/* ============================================================
   PONTOAZT — Layout CSS
   Sidebar, Topbar, Content Grid
   ============================================================ */

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR (Boletos Standalone Style)
   ============================================================ */
.sidebar-menu {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: #ffffff;
    position: fixed;
    left: 0;
    top: 0;
    z-index: var(--z-fixed);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow);
    color: #475569;
    font-family: 'Rajdhani', sans-serif;
    border-right: 2px solid #f97316; /* Orange right border */
    border-top-right-radius: 40px;
    border-bottom-right-radius: 40px;
    box-shadow: 4px 0 15px rgba(0,0,0,0.05);
}

.sidebar-header {
    height: 100px;
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.sidebar-header-texts {
    display: flex;
    flex-direction: column;
}
.brand-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #ea580c; /* Slightly darker orange */
    font-family: 'Rajdhani', sans-serif;
}
.brand-title span { color: #334155; }
.brand-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.sidebar-nav.no-scrollbar::-webkit-scrollbar { display: none; }
.sidebar-nav.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.sidebar-section-text {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 1rem 0.5rem 0.25rem 0.5rem;
    font-family: 'Rajdhani', sans-serif;
}
.sidebar-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0.5rem 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    color: #64748b;
    border: 2px solid transparent;
}
.sidebar-link:hover {
    background-color: #f8fafc;
    color: #334155;
}
.sidebar-link.active {
    background-color: #ffffff;
    border: 2px solid #ea580c;
    color: #334155;
}
.sidebar-link i {
    width: 24px;
    text-align: center;
    font-size: 1.2rem;
    color: #64748b;
}
.sidebar-link-text {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
}
.user-profile:hover { background-color: #f8fafc; }
.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #ea580c; /* Orange avatar background */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 1rem; font-weight: 700; color: #334155; }
.user-role { font-size: 0.8rem; color: #ea580c; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

/* Collapsed sidebar */
.sidebar-menu.collapsed {
    width: var(--sidebar-collapsed-width);
}
.sidebar-menu.collapsed .sidebar-header-texts,
.sidebar-menu.collapsed .sidebar-section-text,
.sidebar-menu.collapsed .sidebar-link-text,
.sidebar-menu.collapsed .user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    white-space: nowrap;
}
.sidebar-menu.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}
.sidebar-menu.collapsed .brand-title {
    font-size: 1.5rem;
}
.sidebar-menu.collapsed .brand-title span { display: none; }
.sidebar-menu.collapsed .brand-title::before { content: "P"; }
.sidebar-menu.collapsed .sidebar-header-texts .brand-title {
    display: block;
    opacity: 1;
    width: auto;
}
.sidebar-menu.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.8rem 0;
    border: none;
    background: transparent;
    gap: 0; /* Remove gap so icon centers perfectly */
}
.sidebar-menu.collapsed .sidebar-link i {
    font-size: 1.1rem; /* 10% smaller than 1.2rem */
}
.sidebar-menu.collapsed .sidebar-link.active {
    border: none;
    background: transparent;
}
.sidebar-menu.collapsed .sidebar-link.active i {
    color: #ea580c;
    font-size: 1.1rem;
}
.sidebar-menu.collapsed .user-profile {
    justify-content: center;
    padding: 0.5rem 0;
    background: transparent;
    gap: 0; /* Remove gap so icon centers perfectly */
}
.sidebar-menu.collapsed .user-avatar {
    background: transparent;
    color: #64748b;
    width: auto;
    height: auto;
    font-size: 1.1rem;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.85);
}
[data-theme="dark"] .topbar {
    background: rgba(17,24,39,0.85);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}
.topbar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 20px;
    transition: all var(--transition-fast);
}
.topbar-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.topbar-breadcrumb-item { cursor: pointer; transition: color var(--transition-fast); }
.topbar-breadcrumb-item:hover { color: var(--primary-600); }
.topbar-breadcrumb-separator { color: var(--text-tertiary); }
.topbar-breadcrumb-current { 
    color: var(--text-primary); 
    font-weight: var(--font-semibold); 
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Search */
.topbar-search {
    position: relative;
    width: 280px;
}
.topbar-search input {
    width: 100%;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-10);
    background: var(--bg-surface-hover);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}
.topbar-search input:focus {
    background: var(--bg-surface);
    border-color: var(--primary-300);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
    width: 340px;
}
.topbar-search-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
}

/* Notifications */
.topbar-notifications {
    position: relative;
}
.topbar-notifications-count {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: var(--font-bold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-surface);
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.theme-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-slow);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.sidebar-menu.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.page-content {
    flex: 1;
    padding: var(--space-6);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}
.page-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}
.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}
.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn var(--transition-fast) ease-out;
}
.modal-backdrop.show { display: flex; }

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn var(--transition-base) ease-out;
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-color);
}
.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}
.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 20px;
    transition: all var(--transition-fast);
}
.modal-close:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    min-width: 320px;
    max-width: 440px;
    pointer-events: all;
    animation: slideInRight var(--transition-slow) ease-out;
}
.toast-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.toast-content { flex: 1; }
.toast-title { font-size: var(--text-sm); font-weight: var(--font-semibold); }
.toast-message { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }
.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.toast-close:hover { background: var(--bg-surface-hover); color: var(--text-primary); }

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

/* Toast exit animation */
.toast.removing {
    animation: fadeOutRight 0.3s ease-in forwards;
}
@keyframes fadeOutRight {
    to { opacity: 0; transform: translateX(100px); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: var(--shadow-2xl);
    }
    .main-content {
        margin-left: 0;
    }
    .topbar-toggle {
        display: flex;
    }
    .topbar-search {
        display: none;
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: var(--space-4);
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .modal {
        max-height: 95vh;
        border-radius: var(--radius-xl);
    }
}
