/**
 * HubMedia Portal - Main Stylesheet
 * Modern Light Theme
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Primary Colors */
    --primary-dark: #1e3a5f;
    --primary-mid: #2c5282;
    --primary-light: #3182ce;
    
    /* Accent Colors */
    --accent-orange: #f39c12;
    --accent-red: #e74c3c;
    --accent-gradient: linear-gradient(135deg, #f39c12 0%, #e74c3c 100%);
    
    /* Text Colors */
    --text-dark: #1a202c;
    --text-medium: #4a5568;
    --text-light: #718096;
    
    /* Background Colors */
    --bg-body: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    --bg-white: #ffffff;
    --bg-light: #f7fafc;
    
    /* Status Colors */
    --success: #38a169;
    --success-light: #c6f6d5;
    --warning: #d69e2e;
    --warning-light: #fefcbf;
    --danger: #e53e3e;
    --danger-light: #fed7d7;
    --info: #3182ce;
    --info-light: #bee3f8;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    
    /* Borders */
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-body);
    background-attachment: fixed;
    min-height: 100vh;
}

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

a:hover {
    color: var(--accent-orange);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--primary-dark);
    line-height: 1.3;
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
    background: var(--primary-dark);
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.top-bar a {
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-bar a:hover {
    color: var(--accent-orange);
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-badge {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.role-badge.admin {
    background: var(--accent-orange);
}

.logout-link {
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
}

.logout-link:hover {
    background: rgba(255,255,255,0.2);
}

/* ============================================
   MAIN HEADER
   ============================================ */
.main-header {
    background: var(--bg-white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo img {
    height: 45px;
}

.logo-text {
    font-size: 26px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
}

.logo-text span:first-child {
    color: var(--accent-orange);
}

.logo-text span:last-child {
    color: var(--primary-dark);
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.main-nav a {
    color: var(--text-medium);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: var(--transition-fast);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent-orange);
    transition: var(--transition-fast);
}

.main-nav a:hover {
    color: var(--primary-dark);
    background: var(--bg-light);
}

.main-nav a:hover::after {
    width: 30px;
}

.main-nav a.active {
    color: var(--accent-orange);
    background: #fff7ed;
}

.main-nav a.active::after {
    width: 30px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-dark);
    transition: var(--transition-fast);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
    min-height: calc(100vh - 200px);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.stat-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-orange);
}

.stat-card.primary { border-color: var(--info); }
.stat-card.primary::before { background: var(--info); }
.stat-card.success { border-color: var(--success); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning { border-color: var(--warning); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger { border-color: var(--danger); }
.stat-card.danger::before { background: var(--danger); }

.stat-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    font-family: 'Poppins', sans-serif;
}

.stat-card.primary .stat-value { color: var(--info); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }

.stat-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(243,156,18,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(243,156,18,0.4);
    color: white;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-medium);
    border: 1px solid var(--border-color);
}

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-dark);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition-fast);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(243,156,18,0.1);
}

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%234a5568' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--bg-white);
}

.table th {
    background: var(--primary-dark);
    color: white;
    padding: 14px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table th.right {
    text-align: right;
}

.table td {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border-color);
}

.table td.right {
    text-align: right;
}

.table td.mono {
    font-family: 'Consolas', monospace;
    font-size: 13px;
}

.table tr:hover td {
    background: var(--bg-light);
}

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

.table tr.highlight td {
    background: var(--success-light);
    font-weight: 600;
}

.table tr.clickable {
    cursor: pointer;
}

.table tr.clickable:hover td {
    background: #fff7ed;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-purple { background: #ede9fe; color: #6b21a8; }
.badge-orange { background: #ffedd5; color: #c2410c; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: var(--success-light);
    border: 1px solid var(--success);
    color: #065f46;
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    color: #92400e;
}

.alert-danger {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: #991b1b;
}

.alert-info {
    background: var(--info-light);
    border: 1px solid var(--info);
    color: #1e40af;
}

.alert-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-light);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition-fast);
}

.tab:hover {
    color: var(--primary-dark);
}

.tab.active {
    color: var(--accent-orange);
    border-bottom-color: var(--accent-orange);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title {
    font-size: 1.75rem;
    color: var(--primary-dark);
}

.page-subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 5px;
}

/* ============================================
   WELCOME SECTION
   ============================================ */
.welcome-section {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    padding: 30px 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--accent-orange);
}

.welcome-section h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.welcome-section p {
    color: var(--text-light);
    margin: 0;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.empty-state-text {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--primary-dark);
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    margin-top: auto;
}

.footer p {
    margin: 0;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 20px;
}

.login-box {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    margin-bottom: 10px;
}

.login-logo span:first-child {
    color: var(--accent-orange);
}

.login-logo span:last-child {
    color: var(--primary-dark);
}

.login-subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
}

.login-error {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-light); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.col {
    padding: 10px;
}

.col-6 { width: 50%; }
.col-4 { width: 33.333%; }
.col-3 { width: 25%; }
.col-12 { width: 100%; }

/* ============================================
   CHARTS
   ============================================ */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
}

.chart-card.full-width {
    grid-column: span 2;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 20px;
}

.chart-container {
    height: 300px;
}

/* ============================================
   DROPZONE
   ============================================ */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 50px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-light);
    transition: var(--transition-fast);
}

.dropzone:hover,
.dropzone.dragging {
    border-color: var(--accent-orange);
    background: #fff7ed;
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.dropzone h3 {
    color: var(--text-dark);
    margin-bottom: 8px;
}

.dropzone p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* ============================================
   FILTER ROW
   ============================================ */
.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 35px 10px 15px;
    border-radius: 8px;
    border: 2px solid var(--accent-orange);
    background: var(--bg-white);
    font-size: 14px;
    min-width: 180px;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(243,156,18,0.2);
}

/* ============================================
   SPINNER
   ============================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .main-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .mobile-menu-btn {
        display: flex;
        position: absolute;
        right: 15px;
        top: 70px;
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 15px;
        box-shadow: var(--shadow-md);
        z-index: 999;
    }
    
    .main-nav.show {
        display: flex;
    }
    
    .main-nav a {
        padding: 15px;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
    }
    
    .main-nav a:last-child {
        border-bottom: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card.full-width {
        grid-column: span 1;
    }
    
    .col-6, .col-4, .col-3 {
        width: 100%;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px 15px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 20px;
    }
    
    .welcome-section {
        padding: 20px;
    }
    
    .welcome-section h1 {
        font-size: 1.25rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-row {
        width: 100%;
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
        min-width: unset;
    }
    
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .tab {
        white-space: nowrap;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .login-box {
        padding: 30px 25px;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .top-bar,
    .main-header,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
        max-width: 100%;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
