/* UI Design System Overrides - eStreamly Aligned */
/* This file should be loaded after styles.css to override with new design system */

/* ========================================
   SIDEBAR LAYOUT
   ======================================== */

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

.sidebar-brand {
    height: var(--es-topbar-height);
    display: flex;
    align-items: center;
    padding: 0 var(--es-space-5);
    border-bottom: 1px solid var(--es-border);
    flex-shrink: 0;
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-logo {
    height: 64px;
    width: auto;
}

.sidebar-nav {
    flex: 1;
    padding: var(--es-space-3) 0;
}

.sidebar-section {
    margin-bottom: var(--es-space-1);
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--es-space-3) var(--es-space-5);
    font-size: var(--es-caption-size);
    font-weight: 600;
    color: var(--es-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    transition: var(--es-transition-fast);
}

.sidebar-section-title:hover {
    color: var(--es-text);
}

.sidebar-chevron {
    transition: transform var(--es-transition-fast);
    transform: rotate(90deg);
}

.sidebar-section.collapsed .sidebar-chevron {
    transform: rotate(0deg);
}

.sidebar-section-items {
    overflow: hidden;
    max-height: 500px;
    transition: max-height var(--es-transition);
}

.sidebar-section.collapsed .sidebar-section-items {
    max-height: 0;
}

.sidebar-item {
    display: block;
    padding: var(--es-space-2) var(--es-space-5);
    padding-left: calc(var(--es-space-5) + var(--es-space-3));
    font-size: var(--es-small-size);
    color: var(--es-text-secondary);
    text-decoration: none;
    transition: var(--es-transition-fast);
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-item::before {
    content: '\2022';
    position: absolute;
    left: var(--es-space-5);
    color: var(--es-text-muted);
    font-size: 0.7rem;
}

.sidebar-item:hover {
    color: var(--es-primary);
    background: var(--es-primary-bg);
}

.sidebar-item.active {
    color: var(--es-primary);
    border-left-color: var(--es-primary);
    background: var(--es-primary-bg);
    font-weight: 500;
}

.sidebar-item.active::before {
    color: var(--es-primary);
}

/* ========================================
   TOP BAR
   ======================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--es-topbar-height);
    padding: 0 var(--es-page-padding-x);
    background: var(--es-surface);
    border-bottom: 1px solid var(--es-border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--es-space-4);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--es-space-3);
}

.topbar-context {
    display: flex;
    align-items: center;
    gap: var(--es-space-4);
}

.topbar-user {
    width: 32px;
    height: 32px;
    border-radius: var(--es-radius-full);
    background: var(--es-primary);
    color: var(--es-text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--es-small-size);
    font-weight: 600;
}

.topbar-user-name {
    line-height: 1;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--es-text-secondary);
    cursor: pointer;
    padding: var(--es-space-2);
    border-radius: var(--es-radius-md);
}

.sidebar-toggle:hover {
    background: var(--es-bg);
    color: var(--es-text);
}

/* ========================================
   MAIN CONTENT WRAPPER
   ======================================== */

.main-wrapper {
    margin-left: var(--es-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--es-page-padding-y) var(--es-page-padding-x);
    max-width: 1400px;
}

/* ========================================
   BASE OVERRIDES
   ======================================== */

body {
    background: var(--es-bg);
    color: var(--es-text);
    font-family: var(--es-font-family);
}

/* ========================================
   NAVBAR (non-authenticated pages)
   ======================================== */

.navbar {
    background: var(--es-surface);
    border-bottom: 1px solid var(--es-border);
    box-shadow: var(--es-shadow-sm);
    height: var(--es-topbar-height);
}

.navbar-brand {
    color: var(--es-text);
    font-weight: 700;
}

.navbar-brand span {
    color: var(--es-text);
}

.navbar-nav a {
    color: var(--es-text-secondary);
    font-weight: 500;
    font-size: var(--es-body-size);
    padding: var(--es-space-2) var(--es-space-3);
    border-radius: var(--es-radius-md);
    transition: var(--es-transition-fast);
}

.navbar-nav a:hover {
    color: var(--es-text);
    background: var(--es-bg);
}

.navbar-nav a.active {
    color: var(--es-primary);
    background: var(--es-primary-light);
}

/* ========================================
   BUTTONS - eStreamly Style
   ======================================== */

.btn {
    background: var(--es-primary);
    color: var(--es-text-inverse);
    border: 1px solid var(--es-primary);
    border-radius: var(--es-radius-md);
    padding: var(--es-space-3) var(--es-space-5);
    font-weight: 500;
    font-size: var(--es-small-size);
    transition: var(--es-transition);
    box-shadow: none;
}

.btn:hover {
    background: var(--es-primary-dark);
    border-color: var(--es-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--es-shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--es-primary);
    border: 1px solid var(--es-primary);
}

.btn-secondary:hover {
    background: var(--es-primary-bg);
    color: var(--es-primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--es-text-secondary);
    border: 1px solid var(--es-border);
}

.btn-outline:hover {
    border-color: var(--es-primary);
    color: var(--es-primary);
    background: var(--es-primary-bg);
}

.btn-sm {
    padding: var(--es-space-2) var(--es-space-3);
    font-size: var(--es-caption-size);
}

/* ========================================
   CARDS - eStreamly Style
   ======================================== */

.card {
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    box-shadow: none;
    transition: var(--es-transition);
}

.card:hover {
    box-shadow: var(--es-shadow-sm);
    transform: none;
}

.card-header {
    border-bottom: 1px solid var(--es-border);
    padding: var(--es-space-5);
}

.card-title {
    font-size: var(--es-h4-size);
    font-weight: 600;
    color: var(--es-text);
}

.card-subtitle {
    font-size: var(--es-small-size);
    color: var(--es-text-secondary);
}

/* ========================================
   STAT CARDS (KPI) - eStreamly Style
   ======================================== */

.stat-card {
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    box-shadow: none;
    padding: var(--es-space-5);
    text-align: left;
    transition: var(--es-transition);
    border-top: none;
}

.stat-card:hover {
    box-shadow: var(--es-shadow-sm);
    transform: none;
}

.stat-card.primary,
.stat-card.success,
.stat-card.warning,
.stat-card.info {
    border-top: none;
}

.stat-label {
    font-size: var(--es-small-size);
    color: var(--es-text-secondary);
    font-weight: 400;
    margin-bottom: var(--es-space-3);
    text-transform: none;
    letter-spacing: normal;
    display: flex;
    align-items: center;
    gap: var(--es-space-2);
}

.stat-value {
    font-size: var(--es-kpi-size);
    font-weight: 700;
    color: var(--es-text);
    line-height: 1.2;
}

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

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--es-caption-size);
    font-weight: 500;
    margin-top: var(--es-space-2);
}

.stat-change.positive {
    color: var(--es-success);
}

.stat-change.negative {
    color: var(--es-danger);
}

/* ========================================
   BADGES - eStreamly Style
   ======================================== */

.badge {
    padding: var(--es-space-1) var(--es-space-3);
    border-radius: var(--es-radius-md);
    font-size: var(--es-caption-size);
    font-weight: 500;
}

.badge-draft {
    background: var(--es-bg);
    color: var(--es-text-secondary);
}

.badge-sent,
.badge-pending {
    background: var(--es-info-light);
    color: var(--es-info);
}

.badge-approved,
.badge-licensed {
    background: var(--es-success-light);
    color: var(--es-success);
}

.badge-denied,
.badge-rejected {
    background: var(--es-danger-light);
    color: var(--es-danger);
}

/* ========================================
   FORMS - eStreamly Style
   ======================================== */

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-md);
    padding: var(--es-space-3) var(--es-space-4);
    font-size: var(--es-body-size);
    color: var(--es-text);
    transition: var(--es-transition-fast);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--es-primary);
    box-shadow: 0 0 0 3px var(--es-primary-bg);
}

.form-group label {
    font-size: var(--es-caption-size);
    font-weight: 500;
    color: var(--es-text-secondary);
    margin-bottom: var(--es-space-2);
}

/* ========================================
   CONTENT CARDS - eStreamly Style
   ======================================== */

.content-card {
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    box-shadow: none;
    transition: var(--es-transition);
}

.content-card:hover {
    box-shadow: var(--es-shadow-md);
    transform: translateY(-2px);
}

.content-card-image {
    border-radius: var(--es-radius-lg) var(--es-radius-lg) 0 0;
}

.content-card-body {
    padding: var(--es-space-5);
}

.content-card-platform {
    font-size: var(--es-caption-size);
    font-weight: 500;
    padding: var(--es-space-1) var(--es-space-3);
    border-radius: var(--es-radius-md);
}

.content-card-platform.instagram {
    background: var(--es-primary-light);
    color: var(--es-primary);
}

.content-card-platform.tiktok {
    background: var(--es-primary-bg);
    color: var(--es-text);
}

.content-card-text {
    font-size: var(--es-body-size);
    color: var(--es-text);
    line-height: 1.5;
}

.content-card-hashtags {
    font-size: var(--es-caption-size);
    color: var(--es-primary);
}

.content-card-metrics {
    font-size: var(--es-caption-size);
    color: var(--es-text-secondary);
}

/* ========================================
   TABLE STYLES - eStreamly Style
   ======================================== */

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

.es-table thead tr {
    border-bottom: 2px solid var(--es-border);
}

.es-table th {
    text-align: left;
    padding: var(--es-space-4);
    font-size: var(--es-small-size);
    font-weight: 500;
    color: var(--es-text-secondary);
}

.es-table td {
    padding: var(--es-space-4);
    border-bottom: 1px solid var(--es-border);
    font-size: var(--es-small-size);
}

.es-table tbody tr:hover {
    background: var(--es-primary-bg);
}

/* ========================================
   PAGE HEADER - eStreamly Style
   ======================================== */

.page-header {
    margin-bottom: var(--es-space-6);
}

.page-title {
    font-size: var(--es-h1-size);
    font-weight: 700;
    color: var(--es-text);
}

/* ========================================
   FLASH MESSAGES
   ======================================== */

.flash-messages {
    margin-bottom: var(--es-space-5);
}

.flash {
    border-radius: var(--es-radius-md);
    padding: var(--es-space-4);
    font-size: var(--es-body-size);
    font-weight: 500;
}

.flash.success {
    background: var(--es-success-light);
    color: var(--es-success-dark);
    border: 1px solid var(--es-success);
}

.flash.error {
    background: var(--es-danger-light);
    color: var(--es-danger-dark);
    border: 1px solid var(--es-danger);
}

.flash.warning {
    background: var(--es-warning-light);
    color: var(--es-warning-dark);
    border: 1px solid var(--es-warning);
}

.flash.info {
    background: var(--es-info-light);
    color: var(--es-info-dark);
    border: 1px solid var(--es-info);
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state {
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    padding: var(--es-space-12);
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--es-space-4);
}

.empty-state-title {
    font-size: var(--es-h3-size);
    font-weight: 600;
    color: var(--es-text);
    margin-bottom: var(--es-space-2);
}

.empty-state-text {
    font-size: var(--es-body-size);
    color: var(--es-text-secondary);
    margin-bottom: var(--es-space-5);
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    margin-top: var(--es-space-8);
    gap: var(--es-space-2);
}

.pagination-info {
    font-size: var(--es-small-size);
    color: var(--es-text-secondary);
}

/* ========================================
   GRID LAYOUT
   ======================================== */

.grid {
    gap: var(--es-space-5);
}

/* ========================================
   ANALYTICS CARD (Special)
   ======================================== */

.analytics-banner {
    background: linear-gradient(135deg, var(--es-primary) 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: var(--es-radius-lg);
    padding: var(--es-space-6) var(--es-space-8);
    box-shadow: var(--es-shadow-md);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        transition: transform 0.25s ease;
    }

    body.sidebar-visible .sidebar {
        transform: translateX(0);
    }

    /* Dark overlay behind sidebar when open */
    body.sidebar-visible .sidebar-overlay {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

@media (max-width: 768px) {
    .page-title {
        font-size: var(--es-h2-size);
    }

    .stat-value {
        font-size: var(--es-kpi-size-sm);
    }

    .card {
        padding: var(--es-space-4);
    }

    .main-content {
        padding: var(--es-space-4);
    }

    .topbar {
        padding: 0 var(--es-space-4);
    }
}

/* Override body sidebar-collapsed state */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: 0;
}
