/**
 * PWD Vault - Corporate Design System (V3)
 * Modern, Secure, Professional.
 */

:root {
    /* Color Palette - Corporate Slate & Blue */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #10b981; /* Emerald/Green for success */
    --warning: #f59e0b; /* Amber for warnings */
    --danger: #ef4444; /* Rose for danger */
    --info: #0ea5e9; /* Sky for info */
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(30, 41, 59, 0.7);
    --sidebar-width: 260px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Light Mode Defaults (To be toggled) */
.light-mode {
    --primary: #2563eb;
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #f1f5f9;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: rgba(0, 0, 0, 0.08);
    --glass: rgba(255, 255, 255, 0.8);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
}

a { text-decoration: none; color: inherit; transition: all 0.2s; }
button { font-family: inherit; border: none; cursor: pointer; transition: all 0.2s; outline: none; }
input, textarea, select { font-family: inherit; outline: none; }

/* === Layout === */

.view-container {
    width: 100%;
    height: 100%;
    display: flex;
}

.hidden { display: none !important; }
.mobile-only { display: none !important; }

/* Mobile Navigation Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(2px);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === Authentication View === */

#auth-view {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);
}

.auth-box {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.logo .dot { color: var(--primary); }

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h2 { font-size: 24px; margin-bottom: 8px; }

/* === Sidebar === */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-logo {
    margin-bottom: 40px;
    padding-left: 12px;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin: 24px 0 8px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.nav-item i { width: 20px; font-size: 16px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.03); color: var(--text-main); }
.nav-item.active { background: var(--primary); color: white; }

.sidebar-bottom {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 8px 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* === Main Content === */

.main-content {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
    position: relative;
    overflow-y: auto;
}

.topbar {
    height: 72px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.search-bar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 320px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    font-size: 14px;
}

.content-area {
    padding: 40px;
}

/* === Dashboard & Bento Grid === */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-4px); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-value { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 14px; color: var(--text-muted); font-weight: 500; }

/* === Tables === */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 16px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-main);
}

.resource-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.resource-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

/* === Forms & Buttons === */

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

input, textarea, select {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-main);
    transition: all 0.2s;
}

input:focus { border-color: var(--primary); background: rgba(255, 255, 255, 0.05); }

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-block { width: 100%; }

.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-icon { background: none; color: var(--text-secondary); font-size: 18px; padding: 8px; display: flex; align-items: center; min-width: 40px; }
.btn-icon:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.05); border-radius: 50%; }

/* === Modals === */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: modalPop 0.3s ease;
}

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

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body { padding: 32px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 24px 32px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* === Tooltips & Tags === */

.tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
}

/* === Toast Notifications === */

.toast {
    position: fixed;
    bottom: 40px;
    right: 40px;
    padding: 16px 24px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* === Strength Meter === */
.strength-meter { height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.strength-bar { height: 100%; width: 0; transition: all 0.3s; }

/* === Responsive === */
.grid-layout-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 40px;
}

.grid-layout-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); position: fixed; top: 0; left: 0; bottom: 0; }
    .sidebar.active { transform: translateX(0); }
    .topbar { padding: 0 20px; }
    .content-area { padding: 24px; }
    .mobile-only { display: flex !important; }
    
    .grid-layout-2-1, .grid-layout-1-1 { grid-template-columns: 1fr !important; }
}