/* ============================================
   BASE44 LEGACY LAYOUT - RCXperience
   Modern Admin Panel with Sidebar Navigation
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;
    --primary-color: #FF004F;
    --primary-dark: #CC003E;
    --secondary-color: #2c3e50;
    --background-color: #f5f6fa;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #e1e8ed;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ===== ADMIN LAYOUT ===== */
body.admin-layout {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--topbar-height);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 12px;
}

.sidebar-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: white;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    display: none;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    text-align: center;
}

.nav-link span {
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active .nav-link {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-badge {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
}

.logout-link {
    color: rgba(255, 255, 255, 0.7) !important;
}

.logout-link:hover {
    color: var(--danger-color) !important;
    background: rgba(231, 76, 60, 0.1) !important;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    overflow: visible;
}

/* ===== TOP BAR ===== */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 999;
    overflow: visible;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
}

.mobile-toggle:hover {
    background: var(--background-color);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: visible;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== CONTENT AREA ===== */
.content {
    flex: 1;
    padding: 30px;
    background: var(--background-color);
}

/* Override style.css main styles when using admin layout */
body.admin-layout main.content {
    min-height: auto;
    padding: 30px;
    background: var(--background-color);
}

/* Ensure proper box-sizing for all elements in admin layout */
body.admin-layout * {
    box-sizing: border-box;
}

/* ===== ADMIN FOOTER ===== */
.admin-footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 20px 30px;
    text-align: center;
}

.footer-content p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ===== COLLAPSED SIDEBAR STATE ===== */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .nav-link span {
    opacity: 0;
    visibility: hidden;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 14px 10px;
}

body.sidebar-collapsed .nav-link i {
    margin-right: 0;
}

body.sidebar-collapsed .sidebar-toggle {
    display: block;
}

/* ===== AUTH LAYOUT (LOGIN PAGE) ===== */
body.auth-layout {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    text-align: center;
}

.auth-logo {
    margin-bottom: 20px;
}

.auth-logo img {
    max-width: 120px;
    height: auto;
}

.auth-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0 0 30px 0;
    font-weight: 500;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.auth-form label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.auth-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 0, 79, 0.1);
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.auth-footer-text {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.auth-footer-text p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 0, 79, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #34495e;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.alert i {
    font-size: 1.1rem;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background: #f0fdf4;
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-info {
    background: #eff6ff;
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

.alert-warning {
    background: #fffbeb;
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet and below */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .mobile-toggle {
        display: block;
    }

    .sidebar-toggle {
        display: none !important;
    }

    .topbar {
        padding: 0 15px;
    }

    .content {
        padding: 20px 15px;
    }

    .page-title {
        font-size: 1.2rem;
    }

    .user-info {
        display: none;
    }

    .auth-box {
        padding: 30px 20px;
    }

    .auth-title {
        font-size: 1.6rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .topbar {
        padding: 0 10px;
    }

    .content {
        padding: 15px 10px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .auth-container {
        padding: 15px;
    }

    .auth-box {
        padding: 25px 15px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}

/* Desktop - Show desktop toggle */
@media (min-width: 769px) {
    .sidebar-toggle {
        display: block;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ===== ANIMATIONS ===== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.content {
    animation: fadeIn 0.3s ease;
}

/* ===== TABLES ===== */
body.admin-layout table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.admin-layout table th,
body.admin-layout table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    background: #2d3748;
}

body.admin-layout table th {
    background: #2d3748;
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.admin-layout table tbody tr {
    transition: background 0.2s;
}

body.admin-layout table tbody tr:hover {
    background: #f8f9fa;
}

body.admin-layout table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== FORMS ===== */
body.admin-layout .form-group {
    margin-bottom: 1.5rem;
}

body.admin-layout .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

body.admin-layout .form-group input,
body.admin-layout .form-group select,
body.admin-layout .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

body.admin-layout .form-group input:focus,
body.admin-layout .form-group select:focus,
body.admin-layout .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 0, 79, 0.1);
}

/* ===== BADGES ===== */
body.admin-layout .badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

body.admin-layout .badge-success,
body.admin-layout .badge-verified {
    background: #d5f4e6;
    color: #27ae60;
}

body.admin-layout .badge-info,
body.admin-layout .badge-new-client {
    background: #d6eaf8;
    color: #3498db;
}

body.admin-layout .badge-warning {
    background: #fef5e7;
    color: #f39c12;
}

body.admin-layout .badge-error,
body.admin-layout .badge-unverified {
    background: #fadbd8;
    color: #e74c3c;
}

body.admin-layout .badge-active {
    background: #d5f4e6;
    color: #27ae60;
}

body.admin-layout .badge-inactive {
    background: #e9ecef;
    color: #7f8c8d;
}

body.admin-layout .badge-vip {
    background: #fef5e7;
    color: #f39c12;
}

body.admin-layout .badge-blacklisted {
    background: #2c3e50;
    color: white;
}

/* ===== PAGE STRUCTURE ===== */
body.admin-layout .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

body.admin-layout .empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.admin-layout .empty-state i {
    font-size: 3rem;
    color: var(--text-light);
    opacity: 0.5;
    margin-bottom: 1rem;
}

body.admin-layout .empty-state p {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* ===== BUTTON VARIANTS ===== */
body.admin-layout .btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

body.admin-layout .btn-block {
    width: 100%;
    display: flex;
    justify-content: center;
}

body.admin-layout .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ===== TEXT UTILITIES ===== */
body.admin-layout .text-muted {
    color: var(--text-light);
}

body.admin-layout strong {
    font-weight: 600;
}

/* ===== USER MENU DROPDOWN ===== */
body.admin-layout .user-menu {
    position: relative;
    display: inline-block;
}

body.admin-layout .user-menu .user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    gap: 0.125rem;
}

body.admin-layout .user-menu .user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.2;
}

body.admin-layout .user-menu .user-role {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: capitalize;
    line-height: 1.2;
}

body.admin-layout .user-menu-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s;
    outline: none;
    position: relative;
    z-index: 1;
    min-width: 200px;
    justify-content: space-between;
}

body.admin-layout .user-menu-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

body.admin-layout .user-menu-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.admin-layout .user-menu-toggle .fa-chevron-down {
    font-size: 0.75rem;
    color: var(--text-light);
    transition: transform 0.2s;
}

body.admin-layout .user-menu.active .user-menu-toggle .fa-chevron-down {
    transform: rotate(180deg);
}

body.admin-layout .user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    width: 220px;
    z-index: 10000;
    display: none;
    overflow: hidden;
    padding: 0.25rem 0;
}

body.admin-layout .user-dropdown.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.admin-layout .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: background-color 0.15s;
    border: none;
    background: white;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    position: relative;
}

body.admin-layout .dropdown-item:first-of-type {
    border-radius: 8px 8px 0 0;
}

body.admin-layout .dropdown-item:last-of-type {
    border-radius: 0 0 8px 8px;
}

body.admin-layout .dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

body.admin-layout .dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--text-light);
    flex-shrink: 0;
}

body.admin-layout .dropdown-item:hover i {
    color: var(--primary-color);
}

body.admin-layout .dropdown-item span {
    flex: 1;
    line-height: 1.4;
}

body.admin-layout .dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0;
}
