/* =============================================
   KineApp — Layout (Sidebar, Header, Grid)
   ============================================= */

/* ══════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════ */

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

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left var(--transition-base);
}

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
    padding: var(--space-4);
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 25% 35%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 75% 65%, rgba(26, 86, 219, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
    animation: subtlePulse 15s ease-in-out infinite;
}

@keyframes subtlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.login-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo .logo-icon {
    font-size: 56px;
    margin-bottom: var(--space-3);
}

.login-logo h1 {
    font-size: var(--fs-4xl);
    font-weight: var(--fw-extrabold);
    background: linear-gradient(135deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    margin-top: var(--space-1);
}

.login-form-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
}

.login-form-card .form-group {
    margin-bottom: var(--space-6);
}

.login-form-card .form-input {
    padding: var(--space-4) var(--space-5);
    font-size: var(--fs-md);
}

/* ══════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--surface);
    border-right: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: var(--space-5) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--surface-border);
}

.sidebar-logo {
    font-size: 28px;
}

.sidebar-brand h2 {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    background: linear-gradient(135deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand p {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-5);
}

.nav-section-title {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-bottom: 2px;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active svg {
    color: var(--primary);
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

/* Sidebar Footer / User info */
.sidebar-footer {
    padding: var(--space-4) var(--space-4);
    border-top: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.sidebar-logout {
    color: var(--text-muted);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-logout:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* ══════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════ */

.header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-6);
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: var(--z-header);
}

.header-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.header-menu-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.header-menu-btn svg {
    width: 24px;
    height: 24px;
}

.header-title {
    flex: 1;
}

.header-title h2 {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
}

.header-title p {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ══════════════════════════════════════════════
   CONTENT
   ══════════════════════════════════════════════ */

.content {
    flex: 1;
    padding: var(--space-6);
    margin-left: var(--sidebar-width);
    max-width: var(--content-max-width);
}

.content-full {
    max-width: none;
}

/* ── Page Title ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-header h2 {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
}

.page-header-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

/* ── Grid Layouts ── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

/* ── Flex Utils ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ── Section ── */
.section {
    margin-bottom: var(--space-8);
}

.section-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ════════════════════════════════════════
   MOBILE SIDEBAR OVERLAY
   ════════════════════════════════════════ */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
    display: none;
}

.sidebar-overlay.active {
    display: block;
    animation: fadeIn 200ms ease;
}
