/* ============================================
   PRAIMPARI Platform - Dark Theme
   Matching PRAIMPARI_PATTERNS color scheme
   ============================================ */

:root {
    /* Primary colors */
    --primary: #58a6ff;
    --primary-light: #79c0ff;
    --primary-dark: #388bfd;
    --primary-rgb: 88, 166, 255;

    /* Success/Green */
    --success: #3fb950;
    --success-light: #56d364;
    --success-dark: #238636;
    --success-rgb: 63, 185, 80;

    /* Warning/Yellow */
    --warning: #d29922;
    --warning-light: #e3b341;
    --warning-rgb: 210, 153, 34;

    /* Danger/Red */
    --danger: #f85149;
    --danger-dark: #da3633;
    --danger-rgb: 248, 81, 73;

    /* Backgrounds */
    --bg-primary: #0f1419;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #0d1117;

    /* Borders */
    --border: #30363d;
    --border-light: #484f58;

    /* Text */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    /* Gradients */
    --gradient-primary: linear-gradient(90deg, #58a6ff 0%, #79c0ff 100%);
    --gradient-success: linear-gradient(90deg, #56d364 0%, #3fb950 100%);
    --gradient-header: linear-gradient(135deg, #1f2937 0%, #111827 100%);

    /* Shadows */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    /* Radius */
    --radius: 6px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

/* ============================================
   Auth Pages Layout
   ============================================ */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.auth-header {
    background: var(--gradient-header);
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header a {
    display: flex;
    justify-content: center;
}

.auth-logo {
    height: 100%;
    width: auto;
    object-fit: contain;
    margin: 0;
    transform: scale(0.4);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.auth-logo:hover {
    transform: scale(0.45);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-body {
    padding: 30px;
}

.auth-footer {
    padding: 20px 30px;
    background: var(--bg-tertiary);
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   Form Elements
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

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

.form-control.error {
    border-color: var(--danger);
}

/* OTP Input */
.otp-input {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 8px;
    font-family: monospace;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    background: var(--border);
    border-color: var(--border-light);
}

.btn-block {
    width: 100%;
}

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

.btn-primary:hover {
    background: var(--success);
    border-color: var(--success);
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

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

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

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 8px 12px;
}

.btn-link:hover {
    text-decoration: underline;
    background: transparent;
}

/* ============================================
   Alerts & Messages
   ============================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    border: 1px solid;
}

.alert.show {
    display: block;
}

.alert-success {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success-light);
    border-color: var(--success-dark);
}

.alert-error {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
    border-color: var(--danger-dark);
}

.alert-warning {
    background: rgba(210, 153, 34, 0.15);
    color: var(--warning-light);
    border-color: var(--warning);
}

.alert-info {
    background: rgba(88, 166, 255, 0.15);
    color: var(--primary-light);
    border-color: var(--primary);
}

/* ============================================
   Loading Spinner
   ============================================ */

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

/* ============================================
   Dashboard Layout
   ============================================ */

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

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header a {
    display: flex;
    justify-content: center;
}

.sidebar-logo {
    height: 160px;
    width: auto;
    max-width: 95%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.sidebar-logo:hover {
    transform: scale(1.02);
}

.sidebar-nav {
    list-style: none;
    padding: 10px 0;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--bg-tertiary);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-nav a svg {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

.main-content {
    flex: 1;
    padding: 30px;
    background: var(--bg-primary);
    overflow-y: auto;
}

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

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 20px;
}

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: 700;
    background: var(--gradient-success);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Tables
   ============================================ */

.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
    color: var(--text-primary);
}

tr:hover td {
    background: rgba(88, 166, 255, 0.05);
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(63, 185, 80, 0.2);
    color: var(--success-light);
}

.badge-warning {
    background: rgba(210, 153, 34, 0.2);
    color: var(--warning-light);
}

.badge-danger {
    background: rgba(248, 81, 73, 0.2);
    color: var(--danger);
}

.badge-info {
    background: rgba(88, 166, 255, 0.2);
    color: var(--primary-light);
}

.badge-gray {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ============================================
   User Info
   ============================================ */

.user-info {
    display: flex;
    align-items: center;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    margin-right: 12px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.user-email {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Code/Mono Text
   ============================================ */

code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-light);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .auth-card {
        max-width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 20px;
    }
}

/* ============================================
   Utilities
   ============================================ */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider::before {
    margin-right: 15px;
}

.divider::after {
    margin-left: 15px;
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}
