/* ============================================================
   KC Reklame ERP v5 - Main Stylesheet
   Modern dark sidebar + clean content area
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a1d29;
    --sidebar-hover: #252836;
    --sidebar-active: #2d6ff7;
    --sidebar-text: #a0a3b1;
    --sidebar-text-active: #ffffff;
    --topbar-height: 60px;
    --body-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1a1d29;
    --text-secondary: #6c757d;
    --border-color: #e5e7eb;
    --primary: #2d6ff7;
    --primary-light: #e8efff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.sidebar-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-tagline {
    font-size: 0.6rem;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-sidebar-close {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    padding: 12px 24px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.25);
    text-transform: uppercase;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(45, 111, 247, 0.12);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 500;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* Sidebar Footer - User */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--sidebar-text);
    font-size: 0.72rem;
}

.btn-logout {
    color: var(--sidebar-text);
    font-size: 1.1rem;
    padding: 6px;
    transition: color 0.15s;
    text-decoration: none;
}

.btn-logout:hover {
    color: var(--danger);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.btn-menu {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-wrapper {
    padding: 24px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-card-primary .stat-icon { background: #e8efff; color: var(--primary); }
.stat-card-success .stat-icon { background: #d1fae5; color: var(--success); }
.stat-card-warning .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-card-info .stat-icon    { background: #cffafe; color: var(--info); }
.stat-card-revenue .stat-icon { background: #d1fae5; color: var(--success); }
.stat-card-danger .stat-icon  { background: #fee2e2; color: var(--danger); }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    margin-bottom: 0;
    font-size: 0.88rem;
}

.table th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom-width: 1px;
    padding: 12px 16px;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: var(--primary-light);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 6px;
}

/* ============================================================
   ACTIVITY LOG
   ============================================================ */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}

/* ============================================================
   AUTH PAGE
   ============================================================ */
.auth-page {
    background: linear-gradient(135deg, #1a3a8a 0%, #2d6ff7 50%, #4a9af5 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.auth-logo-img {
    max-width: 130px;
    height: auto;
    object-fit: contain;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

.auth-form .form-control {
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
}

.auth-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 111, 247, 0.15);
}

.auth-form .btn-primary {
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    background: var(--primary);
    border-color: var(--primary);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   FORMS (general)
   ============================================================ */
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 111, 247, 0.1);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.88rem;
    padding: 8px 16px;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: #2560d9;
    border-color: #2560d9;
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
    border-radius: 10px;
    background: var(--body-bg);
}

/* ============================================================
   OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

body.sidebar-open .sidebar-overlay {
    display: block;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .auth-card {
        padding: 28px;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* ============================================================
   QUILL CONTENT (rendered HTML from rich text editor)
   ============================================================ */
.ql-content p { margin-bottom: 0.25em; }
.ql-content ul, .ql-content ol { margin-bottom: 0.25em; padding-left: 1.5em; }
.ql-content s, .ql-content del { text-decoration: line-through; }
.ql-content blockquote {
    border-left: 3px solid var(--border-color, #e5e7eb);
    padding-left: 0.75em;
    color: var(--text-secondary, #6c757d);
}

/* Quill editor border fix */
#description-editor .ql-editor { min-height: 200px; }
.ql-toolbar.ql-snow { border-radius: 0.375rem 0.375rem 0 0; }
.ql-container.ql-snow { border-radius: 0 0 0.375rem 0.375rem; }
