/* =============================================================================
   DASHTAR THEME - Main Application Styles
   Based on the Dashtar E-commerce Admin Dashboard template
   ============================================================================= */

/* -----------------------------------------------------------------------------
   THEME VARIABLES & RESET
   ----------------------------------------------------------------------------- */
:root {
    --primary-color: #10b981;
    --primary-hover: #059669;
    --bg-body: #f9fafb;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition-speed: 0.3s;
    --input-bg: #f9fafb;

    /* Status Colors */
    --status-pending-bg: #fff7ed;
    --status-pending-text: #c2410c;
    --status-processing-bg: #eff6ff;
    --status-processing-text: #1d4ed8;
    --status-delivered-bg: #d1fae5;
    --status-delivered-text: #047857;
    --status-cancel-bg: #fef2f2;
    --status-cancel-text: #b91c1c;
}

/* DARK MODE OVERRIDES */
body.dark {
    --bg-body: #111827;
    --bg-card: #1f2937;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --input-bg: #111827;
    --status-pending-bg: rgba(255, 237, 213, 0.1);
    --status-processing-bg: rgba(219, 234, 254, 0.1);
    --status-delivered-bg: rgba(209, 250, 229, 0.1);
    --status-cancel-bg: rgba(254, 226, 226, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

/* Utility for Text Colors */
.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

/* -----------------------------------------------------------------------------
   SIDEBAR
   ----------------------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: all var(--transition-speed);
    overflow-y: auto;
}

.brand-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-main);
}

.brand-logo a {
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo i {
    color: var(--primary-color);
    margin-right: 10px;
    font-size: 1.8rem;
}

.menu-list {
    list-style: none;
    padding: 1rem;
    margin: 0;
}

.menu-item {
    margin-bottom: 0.25rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.menu-link i {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.menu-link:hover,
.menu-link.active {
    color: var(--primary-color);
    background-color: rgba(16, 185, 129, 0.08);
}

.menu-link.active {
    position: relative;
}

.menu-link.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    width: 4px;
    height: 30px;
    background: var(--primary-color);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Submenu Chevron */
.menu-link .chevron {
    margin-left: auto;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.menu-link[aria-expanded="true"] .chevron {
    transform: rotate(90deg);
}

.submenu {
    padding-left: 2.5rem;
    list-style: none;
}

.submenu .menu-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Sidebar Logout Button */
.sidebar-logout-btn {
    background-color: var(--primary-color);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: 0.2s;
}

.sidebar-logout-btn:hover {
    background-color: var(--primary-hover);
    color: white;
}

/* -----------------------------------------------------------------------------
   MAIN CONTENT & HEADER
   ----------------------------------------------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed);
    min-height: 100vh;
}

.top-header {
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-left {
    display: flex;
    align-items: center;
}

.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    margin-right: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.icon-btn:hover {
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #ef4444;
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

.profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

/* User Info Dropdown */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.user-name h6 {
    color: var(--text-main);
    margin-bottom: 0;
}

.user-name p {
    color: var(--text-muted);
    margin-bottom: 0;
    font-size: 0.8rem;
}

/* -----------------------------------------------------------------------------
   DASHBOARD CONTENT
   ----------------------------------------------------------------------------- */
.content-padding {
    padding: 2rem;
}

.card-custom {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    padding: 1.5rem;
    height: 100%;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
    border: none;
    border-radius: 1rem;
    color: white;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Stat Card Colors */
.bg-emerald {
    background-color: #10b981;
}

.bg-orange {
    background-color: #f97316;
}

.bg-blue {
    background-color: #3b82f6;
}

.bg-sky {
    background-color: #0ea5e9;
}

.bg-teal {
    background-color: #14b8a6;
}

/* -----------------------------------------------------------------------------
   TABLES
   ----------------------------------------------------------------------------- */
.table-responsive {
    border-radius: 1rem;
    overflow: hidden;
}

.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom th {
    background-color: var(--bg-body);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    background-color: var(--bg-card);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-custom tr:hover td {
    background-color: rgba(16, 185, 129, 0.02);
}

/* Status Badges */
.badge-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-processing {
    background-color: #fce7f3;
    color: #be185d;
}

.status-delivered {
    background-color: var(--status-delivered-bg);
    color: var(--status-delivered-text);
}

.status-pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.status-cancel {
    background-color: var(--status-cancel-bg);
    color: var(--status-cancel-text);
}

.action-btn {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: 0 0.25rem;
    cursor: pointer;
}

.action-btn:hover {
    color: var(--primary-color);
}

/* -----------------------------------------------------------------------------
   FORM ELEMENTS (Global)
   ----------------------------------------------------------------------------- */
.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control,
.form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    border-color: var(--primary-color);
}

/* Buttons */
.btn-primary-custom {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: 0.2s;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    color: white;
}

.btn-outline-danger-custom {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

.btn-outline-danger-custom:hover {
    background-color: #ef4444;
    color: white;
}

.btn-outline-custom {
    background-color: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: 0.2s;
}

.btn-outline-custom:hover {
    border-color: var(--text-muted);
    background-color: var(--border-color);
}

/* Upload Box */
.upload-box {
    border: 2px dashed var(--border-color);
    background-color: var(--input-bg);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

.upload-box:hover {
    border-color: var(--primary-color);
    background-color: rgba(16, 185, 129, 0.02);
}

/* Profile Avatar */
.profile-avatar-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 1.5rem auto;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-body);
    box-shadow: 0 0 0 1px var(--border-color);
}

.avatar-edit-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.avatar-edit-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.1);
}

/* Settings Tabs (Vertical) */
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-link:hover {
    background-color: var(--bg-body);
    color: var(--text-main);
}

.settings-link.active {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.settings-link i {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

/* Tab Pane Animation */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -----------------------------------------------------------------------------
   FOOTER
   ----------------------------------------------------------------------------- */
.dashtar-footer {
    padding: 1rem 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* Dropdown styling override */
.dropdown-menu {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.dropdown-item {
    color: var(--text-main);
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: rgba(16, 185, 129, 0.08);
    color: var(--primary-color);
}

.dropdown-header {
    color: var(--text-muted);
}

/* Pagination */
.pagination .page-link {
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    background-color: var(--bg-card);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Simple DataTable override */
.dataTable-wrapper .dataTable-top,
.dataTable-wrapper .dataTable-bottom {
    padding: 1rem;
}

/* Toast overrides - keep existing toastify working */

/* -----------------------------------------------------------------------------
   RESPONSIVE
   ----------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .stat-card {
        margin-bottom: 1rem;
    }

    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 1rem;
    }

    .settings-link {
        white-space: nowrap;
    }
}
