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

/* System Variables - Premium Dark Theme Palette */
:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(20, 28, 47, 0.7);
    --bg-card-hover: rgba(28, 39, 65, 0.85);
    --bg-sidebar: #0f172a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(59, 130, 246, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-primary: #3b82f6; /* Cobalt Blue */
    --color-primary-hover: #2563eb;
    --color-secondary: #10b981; /* Emerald Green */
    --color-secondary-hover: #059669;
    --color-accent: #6366f1; /* Indigo */
    --color-danger: #ef4444; /* Soft Red */
    --color-warning: #f59e0b; /* Amber */
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.25);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Core Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.05) 0px, transparent 50%);
}

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

a:hover {
    color: var(--text-primary);
}

/* Glassmorphism Card Utility */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(59, 130, 246, 0.25);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    background: var(--bg-card-hover);
}

/* Typography and Headings */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.text-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Hub Layout (Main Index page) */
.hub-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    text-align: center;
}

.hub-header {
    margin-bottom: 4rem;
}

.hub-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hub-header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

.db-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

.db-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.db-dot.connected {
    background-color: var(--color-secondary);
    box-shadow: 0 0 10px var(--color-secondary);
}

.db-dot.disconnected {
    background-color: var(--color-danger);
    box-shadow: 0 0 10px var(--color-danger);
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.hub-card {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 320px;
    cursor: pointer;
}

.hub-card-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.05);
}

.hub-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.hub-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    color: white;
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: var(--color-secondary);
    color: white;
}

.btn-success:hover {
    background: var(--color-secondary-hover);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Login Layout */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo h2 {
    font-size: 2.2rem;
    font-weight: 800;
}

.login-logo p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: rgba(15, 23, 42, 0.9);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
}

/* Admin Dashboard Layout */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
}

.sidebar-brand {
    margin-bottom: 3rem;
    text-align: center;
}

.sidebar-brand h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu-item a:hover,
.sidebar-menu-item.active a {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sidebar-menu-item.active a {
    border-left: 3px solid var(--color-primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background: rgba(59, 130, 246, 0.08);
}

.sidebar-user {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.user-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    overflow-y: auto;
    max-width: calc(100% - 280px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title h1 {
    font-size: 2rem;
    font-weight: 800;
}

.page-title p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stats-card {
    padding: 1.5rem 2rem;
}

.stats-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stats-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin-top: 0.5rem;
    line-height: 1;
}

/* Tables and Data Displays */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.data-table th {
    background: rgba(15, 23, 42, 0.4);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.data-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 30px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Modals & Split Layouts (for Form + List) */
.layout-split {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .layout-split {
        grid-template-columns: 1fr;
    }
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-body {
    padding: 1.5rem;
}

/* Station Checklist styling for user edit */
.station-roles-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.station-role-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.station-role-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.station-role-select {
    padding: 4px 8px;
    font-size: 0.8rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
}

/* Custom Checkbox style */
input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 16px;
    height: 16px;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem;
    }
    
    .main-content {
        max-width: 100%;
        padding: 1.5rem;
    }
}
