/* ===== CSS Variables ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --border-radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --accent-blue: #4f46e5;
    --accent-purple: #7c3aed;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Sidebar Styles ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-brand-icon {
    width: 45px;
    height: 45px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sidebar-brand-text {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.sidebar-brand-text small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0;
}

.sidebar-section {
    padding: 1.25rem 1rem 0.5rem;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: 4px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    margin: 0 0.5rem;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.sidebar-nav-link.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sidebar-nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

/* ===== Main Content ===== */
.main-wrapper {
    margin-left: 280px;
    min-height: 100vh;
    transition: var(--transition);
}

.top-header {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-header-title i {
    color: var(--accent-purple);
}

.top-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-content {
    padding: 2rem;
}

/* ===== Card Styles ===== */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--card-hover-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header i {
    color: var(--accent-purple);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    border-radius: var(--border-radius);
    padding: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.stat-card:hover::before {
    transform: scale(1.5);
}

.stat-card.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.green { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.stat-card.orange { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-card.cyan { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-card.purple { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.stat-card.red { background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%); }

.stat-card-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    opacity: 0.3;
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    position: relative;
}

.stat-card-label {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
    position: relative;
}

.stat-card-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 1rem;
    opacity: 0.9;
    transition: var(--transition);
    position: relative;
}

.stat-card-link:hover {
    opacity: 1;
    color: white;
    gap: 10px;
}

/* ===== Filter Card ===== */
.filter-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border: none;
    margin-bottom: 1.5rem;
}

.filter-card .card-header {
    background: transparent;
    font-weight: 600;
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius-sm);
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.modern-table thead th {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1rem 1.25rem;
    border: none;
    white-space: nowrap;
}

.modern-table thead th:first-child {
    border-top-left-radius: var(--border-radius-sm);
}

.modern-table thead th:last-child {
    border-top-right-radius: var(--border-radius-sm);
}

.modern-table tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
    font-size: 0.9rem;
}

.modern-table tbody tr {
    transition: var(--transition);
}

.modern-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

.modern-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--border-radius-sm);
}

.modern-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--border-radius-sm);
}

/* ===== Badges ===== */
.badge {
    font-weight: 600;
    padding: 0.5em 1em;
    border-radius: 50px;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-gradient-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-gradient-green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.badge-gradient-orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.badge-gradient-cyan {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.badge-soft-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent-blue);
}

.badge-soft-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.badge-soft-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}

.badge-soft-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.badge-soft-info {
    background: rgba(79, 70, 229, 0.1);
    color: #0891b2;
}

/* ===== Buttons ===== */
.btn {
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: var(--primary-gradient);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(17, 153, 142, 0.4);
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.btn-outline-secondary {
    border: 2px solid #e5e7eb;
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: var(--text-primary);
}

.btn-outline-primary {
    border: 2px solid var(--accent-purple);
    color: var(--accent-purple);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
}

/* ===== Form Controls ===== */
.form-control, .form-select {
    border: 2px solid #e5e7eb;
    border-radius: var(--border-radius-sm);
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ===== Pagination ===== */
.pagination {
    gap: 5px;
}

.page-item .page-link {
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.page-item .page-link:hover {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-purple);
}

.page-item.active .page-link {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.page-item.disabled .page-link {
    background: transparent;
    color: #d1d5db;
}

/* ===== Data Link ===== */
.data-link {
    color: var(--accent-purple);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.data-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* ===== Detail Page Styles ===== */
.detail-header {
    background: var(--primary-gradient);
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.detail-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 50%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.detail-header-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
}

.detail-header-subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
    position: relative;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.info-item {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.info-item:hover {
    background: rgba(124, 58, 237, 0.05);
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-gradient);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.timeline-content {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-top: 0.5rem;
}

/* ===== Comment Section ===== */
.comment-item {
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-purple);
    transition: var(--transition);
}

.comment-item:hover {
    background: rgba(124, 58, 237, 0.05);
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.comment-body {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Quick Stats Widget ===== */
.quick-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.quick-stat:last-child {
    border-bottom: none;
}

.quick-stat-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.quick-stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== Related Items ===== */
.related-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.related-item:hover {
    background: rgba(124, 58, 237, 0.05);
    color: var(--accent-purple);
}

.related-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.related-item-icon.blue { background: rgba(79, 70, 229, 0.1); color: var(--accent-blue); }
.related-item-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.related-item-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--accent-orange); }
.related-item-icon.purple { background: rgba(124, 58, 237, 0.1); color: var(--accent-purple); }

/* ===== Status Indicators ===== */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-dot.active { background: var(--accent-green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.status-dot.inactive { background: var(--accent-red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
.status-dot.pending { background: var(--accent-orange); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state-text {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-toggle {
        display: flex !important;
    }
}

@media (max-width: 767.98px) {
    .main-content {
        padding: 1rem;
    }

    .top-header {
        padding: 1rem;
    }

    .stat-card-value {
        font-size: 2rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s ease-out forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    width: 100%;
    max-width: 420px;
}

.login-header {
    background: var(--primary-gradient);
    padding: 2rem;
    text-align: center;
    color: white;
}

.login-header h4 {
    margin: 0;
    font-weight: 700;
}

.login-body {
    padding: 2rem;
}

.login-footer {
    padding: 1rem 2rem;
    background: #f8fafc;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== User Menu ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info {
    font-size: 0.85rem;
}

.user-name {
    font-weight: 600;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.5rem;
    width: calc(100% - 1rem);
    justify-content: center;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
}
