/**
 * Popular Marketing Admin - Custom Styles
 * Bootstrap 5 Based Admin Theme
 */

/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --navbar-height: 56px;
    --primary-color: #667eea;
    --secondary-color: #764ba2;
}

/* ============================================
   Layout Structure
   ============================================ */
#wrapper {
    min-height: 100vh;
}

#sidebar-wrapper {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

#page-content-wrapper {
    width: 100%;
    min-height: 100vh;
    margin-left: 0;
    transition: margin-left 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

#page-content-wrapper.sidebar-collapsed {
    margin-left: 0;
}

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar-heading {
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav .nav-link {
    border-radius: 0;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff !important;
}

.sidebar-nav .nav-link.active {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

.nav-section-header {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.sidebar-footer {
    position: sticky;
    bottom: 0;
    background: #212529;
}

/* ============================================
   Navbar Styles
   ============================================ */
.navbar {
    height: var(--navbar-height);
}

.breadcrumb {
    font-size: 0.875rem;
}

/* ============================================
   Card Styles
   ============================================ */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* ============================================
   Table Styles (DataTables Compatible)
   ============================================ */
.table th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-top: none;
}

.table td {
    vertical-align: middle;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.875rem;
    color: #6c757d;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin: 0 2px;
}

/* ============================================
   Form Styles
   ============================================ */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Required field indicator */
.form-label.required::after {
    content: " *";
    color: #dc3545;
}

/* ============================================
   Button Styles
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

/* ============================================
   Badge Styles
   ============================================ */
.badge {
    font-weight: 500;
}

/* Status badges */
.badge-active {
    background-color: #198754;
}

.badge-inactive {
    background-color: #6c757d;
}

.badge-pending {
    background-color: #ffc107;
    color: #000;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-shadow:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Loading spinner overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ============================================
   Stats Cards
   ============================================ */
.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Chart Container
   ============================================ */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ============================================
   Action Buttons Group
   ============================================ */
.action-buttons .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        transform: translateX(-100%);
    }

    #sidebar-wrapper[x-show="true"] {
        transform: translateX(0);
    }

    #page-content-wrapper {
        margin-left: 0;
    }

    .navbar-brand {
        font-size: 1rem;
    }
}

@media (max-width: 767.98px) {
    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .card-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .card-header .btn-group {
        width: 100%;
    }

    .card-header .btn {
        flex: 1;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    #sidebar-wrapper {
        display: none !important;
    }

    #page-content-wrapper {
        margin-left: 0 !important;
    }

    .navbar {
        display: none !important;
    }

    .btn, .action-buttons {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ============================================
   Animation Classes
   ============================================ */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   Transition Classes for Alpine.js
   ============================================ */
.transition-transform {
    transition-property: transform;
    transition-timing-function: ease-in-out;
    transition-duration: 300ms;
}

.-translate-x-full {
    transform: translateX(-100%);
}

.translate-x-0 {
    transform: translateX(0);
}
