/**
 * Custom styles for Expense Management System
 */

/* Global Styles */
:root {
    --primary-color: #5b9ad5;
    --primary-hover: #4482bd;
    --secondary-color: #7c8db5;
    --success-color: #2ecc71;
    --info-color: #3498db;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #f8f9fc;
    --dark-color: #2d3748;
    --border-color: #e2e8f0;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --text-color: #4a5568;
    --text-muted: #718096;
    --card-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #f9fafb;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Modern UI Layout */
.modern-ui {
    overflow-x: hidden;
}

.app-container {
    display: flex;
    position: relative;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar-nav {
    width: var(--sidebar-width);
    background-color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-speed) ease, width var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.app-brand {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.25rem;
}

.brand-icon {
    font-size: 1.75rem;
    margin-right: 0.75rem;
}

.brand-text {
    white-space: nowrap;
    transition: opacity var(--transition-speed) ease;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-title {
    padding: 0 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

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

.menu-item {
    margin: 0.25rem 0;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
}

.menu-link:hover {
    background-color: rgba(67, 97, 238, 0.08);
    color: var(--primary-color);
}

.menu-item.active .menu-link {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.menu-icon {
    width: 1.5rem;
    margin-right: 1rem;
    display: flex;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
}

.user-info i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.user-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.logout-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: color var(--transition-speed) ease;
}

.logout-btn:hover {
    color: var(--danger-color);
}

/* Mobile Close Button */
.mobile-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 1001;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color var(--transition-speed) ease;
}

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

.user-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-color);
    border-radius: 50%;
    margin-right: 0.75rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.user-name {
    font-weight: 500;
}

.content-body {
    flex: 1;
    padding: 1.5rem;
    background-color: #f9fafb;
    min-width: 0; /* Ensures content doesn't overflow */
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Card Styles */
.card {
    background-color: #fff;
    border-radius: 0.5rem;
    border: none;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.card-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--primary-color);
}

.card-body {
    padding: 1.25rem;
}

/* Utility Classes */
.border-left-primary {
    border-left: 0.25rem solid var(--primary-color);
}

.border-left-success {
    border-left: 0.25rem solid var(--success-color);
}

.border-left-info {
    border-left: 0.25rem solid var(--info-color);
}

.border-left-warning {
    border-left: 0.25rem solid var(--warning-color);
}

.border-left-danger {
    border-left: 0.25rem solid var(--danger-color);
}

.text-gray-300 {
    color: #dddfeb;
}

.text-gray-800 {
    color: #5a5c69;
}

.font-weight-bold {
    font-weight: 700;
}

.text-xs {
    font-size: 0.7rem;
}

/* Table Styles */
.table {
    color: var(--text-color);
}

.table-bordered th,
.table-bordered td {
    border-color: var(--border-color);
}

.table thead th {
    background-color: var(--light-color);
    font-weight: 600;
    border-bottom-width: 1px;
    vertical-align: middle;
}

/* Form Styles */
.form-control, .form-select {
    border-color: var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: border-color var(--transition-speed) ease;
}

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

.form-control-sm, .form-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Button Styles */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.95rem;
}

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

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Chart Styles */
.chart-area {
    position: relative;
    height: 300px;
    margin: 0 auto;
    width: 100%;
}

.chart-pie {
    position: relative;
    height: 300px;
    margin: 0 auto;
    width: 100%;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .sidebar-nav {
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 1100;
        width: 85%;
        max-width: 280px;
        position: fixed;
        top: 0;
        bottom: 0;
        height: 100%;
    }
    
    .mobile-close {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.25rem;
        cursor: pointer;
        z-index: 1101;
        padding: 8px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.1);
        transition: all 0.2s ease;
    }
    
    .mobile-close:hover, .mobile-close:focus {
        background-color: rgba(255, 255, 255, 0.2);
        color: #fff;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .app-container.sidebar-expanded .sidebar-nav {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .app-container.sidebar-expanded .overlay {
        display: block;
        opacity: 1;
    }
    
    .sidebar-toggle {
        cursor: pointer;
        padding: 10px;
        border-radius: 4px;
        background-color: #f8f9fa;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #eee;
        transition: all 0.2s ease;
    }
    
    .sidebar-toggle:hover, .sidebar-toggle:focus {
        background-color: #e9ecef;
        color: var(--primary-color);
    }
    
    .chart-area, .chart-pie {
        max-width: 100%;
        height: 250px;
    }
}

@media (max-width: 576px) {
    .content-header {
        padding: 0 1rem;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    .user-name {
        display: none;
    }
    
    .chart-area, .chart-pie {
        height: 200px;
    }
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9fafb;
}

.login-card {
    width: 100%;
    max-width: 28rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.login-header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.login-form {
    padding: 2rem;
}

.login-footer {
    padding: 1rem 2rem;
    background-color: var(--light-color);
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Upload Field */
.custom-file-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.custom-file-upload:hover {
    background-color: rgba(67, 97, 238, 0.08);
    border-color: var(--primary-color);
}

.custom-file-upload i {
    color: var(--primary-color);
}

.custom-file-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background-color: rgba(243, 156, 18, 0.2);
    color: #c87f0a;
}

.status-approved {
    background-color: rgba(46, 204, 113, 0.2);
    color: #1e8a5f;
}

.status-rejected {
    background-color: rgba(231, 76, 60, 0.2);
    color: #b93d30;
}

/* Improve dashboard display */
.chart-card {
    height: 100%;
}

.chart-area, .chart-pie {
    width: 100% !important;
    height: 300px !important;
}

canvas {
    max-width: 100%;
}

/* Dashboard Stat Cards */
.dashboard-stat-card {
    transition: transform 0.2s ease;
}

.dashboard-stat-card:hover {
    transform: translateY(-5px);
}

/* Improve table responsiveness */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix image preview */
.receipt-preview {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

/* Ensure charts render properly */
canvas {
    max-width: 100% !important; 
}
/* Additional styles for mobile fixes */
@media (max-width: 992px) {
    .sidebar-nav {
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 1100;
        width: 85%;
        max-width: 280px;
        position: fixed;
        top: 0;
        bottom: 0;
        height: 100%;
        transition: transform 0.3s ease;
    }
    
    .mobile-close {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.25rem;
        cursor: pointer;
        z-index: 1101;
        padding: 8px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.1);
        transition: all 0.2s ease;
    }
    
    .mobile-close:hover, .mobile-close:focus {
        background-color: rgba(255, 255, 255, 0.2);
        color: #fff;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .app-container.sidebar-expanded .sidebar-nav {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .app-container.sidebar-expanded .overlay {
        display: block;
        opacity: 1;
    }
    
    .sidebar-toggle {
        cursor: pointer;
        padding: 10px;
        border-radius: 4px;
        background-color: #f8f9fa;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #eee;
        transition: all 0.2s ease;
    }
    
    .sidebar-toggle:hover, .sidebar-toggle:focus {
        background-color: #e9ecef;
        color: var(--primary-color);
    }
}
