/**
 * Site CSS - CustomerPortal
 * Main stylesheet with global styles and layout
 * Version: 2.0.0 - Sidebar Layout
 */

/* ===============================================
   GLOBAL STYLES & CSS VARIABLES
   =============================================== */

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --header-bg: #ffffff;
    --header-height: 70px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #334155;
    --sidebar-active: #4f46e5;
    --bg-color: #f1f5f9;
    --text-color: #334155;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===============================================
   LAYOUT - SIDEBAR & HEADER
   =============================================== */

.layout-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

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

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.brand-logo i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.brand-logo-img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.brand-logo:hover {
    color: var(--primary-color);
}

.brand-logo .tenant-name {
    font-weight: 400;
    color: #64748b;
    margin-left: 0.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-avatar i {
    font-size: 1.5rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

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

.user-role {
    font-size: 0.75rem;
    color: #94a3b8;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.logout-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.sidebar-content {
    padding: 1.5rem 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
}

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

.nav-item.active {
    background-color: rgba(79, 70, 229, 0.1);
    border-left-color: var(--sidebar-active);
    color: white;
}

/* Main Content Wrapper */
.main-content-wrapper {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.3s ease;
}

.content-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar Collapsed State */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

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

body.sidebar-collapsed .nav-item span {
    display: none;
}

body.sidebar-collapsed .nav-section-title {
    display: none;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem;
}

/* ===============================================
   PAGE TITLE
   =============================================== */

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title i {
    color: var(--primary-color);
}

.page-subtitle {
    font-size: 1rem;
    color: #6c757d;
    margin-top: -1rem;
    margin-bottom: 2rem;
}

/* ===============================================
   DASHBOARD WELCOME BANNER
   =============================================== */

.dashboard-welcome {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 2.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
}

.welcome-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.welcome-text {
    flex: 1;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: white;
}

.welcome-subtitle {
    font-size: 1rem;
    opacity: 0.95;
    line-height: 1.6;
    max-width: 600px;
}

.welcome-icon {
    font-size: 6rem;
    opacity: 0.2;
}

/* ===============================================
   STATISTICS CARDS
   =============================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
}

.stat-card-primary .stat-icon {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}

.stat-card-success .stat-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.stat-card-warning .stat-icon {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.stat-card-info .stat-icon {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
}

.stat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: var(--bg-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.stat-link:hover {
    background-color: var(--primary-color);
    color: white;
}

/* ===============================================
   QUICK ACTIONS
   =============================================== */

.quick-actions-grid {
    display: grid;
    gap: 1rem;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.quick-action-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.quick-action-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}

.quick-action-success {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.quick-action-info {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.quick-action-warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.quick-action-content {
    flex: 1;
}

.quick-action-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.quick-action-desc {
    font-size: 0.875rem;
    color: #64748b;
}

.quick-action-arrow {
    font-size: 1.25rem;
    color: #cbd5e1;
}

/* ===============================================
   INFO LIST (Notifications/Announcements)
   =============================================== */

.info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.info-item:hover {
    background-color: #e2e8f0;
}

.info-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.info-icon-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
}

.info-icon-success {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.info-icon-info {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.info-content {
    flex: 1;
}

.info-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.info-desc {
    font-size: 0.813rem;
    color: #64748b;
    line-height: 1.5;
}

/* ===============================================
   ALERTS
   =============================================== */

.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alert i {
    margin-right: 0.5rem;
}

/* ===============================================
   MODALS
   =============================================== */

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 2px solid #dee2e6;
    border-radius: 12px 12px 0 0;
}

.modal-footer {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 12px 12px;
}

/* ===============================================
   EMPTY STATES
   =============================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #dee2e6;
}

.empty-state h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #495057;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ===============================================
   LOADING STATES
   =============================================== */

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ===============================================
   UTILITY CLASSES
   =============================================== */

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

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

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

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content-wrapper {
        margin-left: 0;
    }

    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-collapsed .main-content-wrapper {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 0 1rem;
    }

    .brand-logo span {
        display: none;
    }

    .user-details {
        display: none;
    }

    .content-container {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .welcome-icon {
        display: none;
    }

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

    .dashboard-welcome {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .top-header {
        padding: 0 0.75rem;
    }

    .content-container {
        padding: 1rem;
    }

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

    .welcome-title {
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .quick-action-item {
        padding: 1rem;
    }

    .quick-action-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

/* Mobile Sidebar Toggle */
@media (max-width: 992px) {
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .sidebar {
        box-shadow: var(--shadow-lg);
    }
}

/* Sidebar Toggle for Mobile */
@media (max-width: 992px) {
    body:not(.sidebar-open) .sidebar {
        transform: translateX(-100%);
    }

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

/* ===============================================
   PRINT STYLES
   =============================================== */

@media print {
    .header,
    .footer,
    .btn,
    .logout-btn {
        display: none;
    }

    body {
        background: white;
    }

    .main-content {
        max-width: 100%;
        padding: 0;
    }

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