/* =========================================
   1. GLOBAL VARIABLES
   ========================================= */
:root {
    --primary-color: #6C5DD3; /* Purple */
    --secondary-color: #FF754C;
    --bg-color: #F4F7FE; /* Dashboard BG */
    --sidebar-width: 280px;
    --card-shadow: 0px 18px 40px rgba(112, 144, 176, 0.12);
}

body {
    font-family: 'DM Sans', 'Nunito', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: #1B2559;
    overflow-x: hidden; /* Prevent horizontal scroll globally */
}

a {
    text-decoration: none;
}

/* =========================================
   2. LOGIN / SIGNUP PAGE STYLES (MODERNIZED)
   ========================================= */
#auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    width: 100%;
    position: relative; /* Changed from fixed to relative for better mobile scrolling */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden; /* Clip overflowing shapes to prevent horizontal scroll */
}

/* Modern Mesh Gradient Background */
.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.5;
    animation: pulse 10s infinite ease-in-out alternate;
}

.shape-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: #8B78E6;
    animation-delay: 0s;
}

.shape-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: #FF754C;
    animation-delay: -5s;
}

.shape-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: #6C5DD3;
    opacity: 0.3;
    animation-delay: -2s;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(10px, -10px); }
}

/* Glassmorphism Card with Custom Entrance */
.auth-card {
    background: rgba(255, 255, 255, 0.95); /* Increased opacity for readability */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 450px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 1;
    margin: auto; /* Center vertically if scrolling */

    /* Custom Entrance Animation */
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.icon-container {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #6C5DD3 0%, #8B78E6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 25px rgba(108, 93, 211, 0.3);
    color: white;
    font-size: 1.8rem;
}

.auth-header h3 {
    font-weight: 800;
    color: #1B2559;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
    font-size: 1.5rem;
}

.form-control {
    border-radius: 12px !important; /* Slightly less rounded for modern feel */
    background-color: #F4F7FE !important;
    border: 2px solid transparent !important;
    padding: 12px 15px !important;
    font-size: 1rem; /* Increased font size for mobile inputs */
    font-weight: 500;
    transition: all 0.2s ease;
    height: 50px; /* Taller inputs for touch targets */
}

.form-control:focus {
    background-color: #fff !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(108, 93, 211, 0.1) !important;
}

.input-group-text {
    background-color: #F4F7FE !important;
    border: 2px solid transparent !important;
    border-right: none !important;
    border-radius: 12px 0 0 12px !important;
    padding-left: 15px;
}

.input-group .form-control {
    border-radius: 0 12px 12px 0 !important;
}

.btn-auth {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px; /* Matching inputs */
    background: linear-gradient(135deg, #6C5DD3 0%, #5a4cb4 100%);
    color: white !important;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 10px 20px rgba(108, 93, 211, 0.25);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    margin-top: 15px;
    text-transform: uppercase; /* Ensure buttons are uppercase */
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(108, 93, 211, 0.35);
    background: linear-gradient(135deg, #5a4cb4 0%, #483D8B 100%);
}

.hover-underline:hover {
    text-decoration: underline !important;
}

/* Label Styling for Auth Pages */
.auth-card label {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    display: block;
}

/* =========================================
   3. DASHBOARD SIDEBAR (White Theme)
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050; /* Higher z-index to sit above content */
    padding: 30px 20px;
    border-right: 1px solid #f0f0f0;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Fix for logo overlap on desktop */
.brand img {
    max-width: 100%;
    height: auto;
    display: block;
}

.nav-link {
    color: #8F9BBA;
    padding: 14px 15px; /* Larger touch target */
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: 0.2s;
    font-size: 1rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
    background: transparent;
    font-weight: 700;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    height: 30px;
    width: 4px;
    background: var(--primary-color);
    border-radius: 4px 0 0 4px;
}

/* Add Expense Button */
.btn-cta {
    background: var(--primary-color);
    color: white !important;
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    display: block;
    margin-bottom: 30px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(108, 93, 211, 0.3);
    font-size: 1rem;
}

/* =========================================
   4. MAIN CONTENT & CARDS
   ========================================= */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    transition: margin-left 0.3s ease-in-out;
    min-height: 100vh;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.search-bar {
    background: white;
    border-radius: 30px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    width: 300px;
    box-shadow: var(--card-shadow);
}

.search-bar input {
    border: none;
    outline: none;
    width: 100%;
    margin-left: 10px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 8px 15px;
    border-radius: 30px;
    box-shadow: var(--card-shadow);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: var(--card-shadow);
    padding: 25px;
    height: 100%;
}

/* Stats Icons Colors */
.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.bg-purple-light {
    background: #F4F2FF;
    color: var(--primary-color);
}

.bg-green-light {
    background: #E9FAF5;
    color: #00D09C;
}

.bg-orange-light {
    background: #FFF0E9;
    color: var(--secondary-color);
}

.bg-blue-light {
    background: #E6F0FF;
    color: #3F8CFF;
}

/* =========================================
   5. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    /* Sidebar hidden by default on mobile */
    .sidebar {
        margin-left: -280px;
        transform: translateX(0);
        box-shadow: none;
        width: 280px; /* Fixed width for mobile sidebar */
    }

    /* Show sidebar when active */
    .sidebar.show {
        margin-left: 0;
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1045; /* Below sidebar, above content */
        display: none;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-top: 90px; /* Space for fixed top bar */
    }

    /* Top Header adjustments */
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .top-header > div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    /* Card adjustments */
    .card {
        padding: 20px;
        margin-bottom: 20px;
    }

    /* Table adjustments */
    .table-responsive {
        border-radius: 15px;
        border: 1px solid #f0f0f0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th, .table td {
        white-space: nowrap; /* Prevent text wrapping in small columns */
        padding: 15px;
        font-size: 0.95rem;
    }

    /* Auth pages - Mobile Fix */
    .auth-card {
        padding: 25px 20px;
        margin: 0 auto; /* Center it */
        max-width: 100%;
        width: 90%; /* Use 90% width to ensure margins */
    }

    #auth-page {
        padding: 15px; /* Container padding */
        align-items: center; /* Center vertically */
        justify-content: center;
        min-height: 100vh;
        overflow-x: hidden; /* Ensure no horizontal scroll on mobile */
    }

    /* Hide shapes on mobile to prevent overflow issues */
    .shape {
        display: none;
    }

    /* Increase font sizes for mobile readability */
    body {
        font-size: 16px;
    }

    h3, h4, h5 {
        font-size: 1.3rem;
    }

    .small, small {
        font-size: 0.85rem;
    }

    /* Fix fixed top bar on mobile */
    .fixed-top {
        z-index: 1040; /* Below sidebar */
        background: white;
        padding: 15px !important;
    }
}

/* --- PROJECT CARD IMPROVED --- */
.project-card {
    background: white;
    border-radius: 24px; /* More rounded */
    padding: 25px;
    box-shadow: 0 10px 30px rgba(112, 144, 176, 0.08); /* Softer shadow */
    border: 1px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(112, 144, 176, 0.15);
    border-color: rgba(108, 93, 211, 0.1); /* Subtle purple border on hover */
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.project-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #F4F2FF 0%, #EBE7FF 100%);
    color: var(--primary-color);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 10px rgba(108, 93, 211, 0.1);
}

.project-actions {
    display: flex;
    gap: 10px;
}

.btn-action-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}

.edit-btn {
    background: #F4F7FE;
    color: #A3AED0;
}

.edit-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(15deg);
}

.del-btn {
    background: #FFF5F5;
    color: #FF5B5B;
}

.del-btn:hover {
    background: #FF5B5B;
    color: white;
    transform: scale(1.1);
}

.project-stats {
    display: flex;
    justify-content: space-between;
    background: #F8F9FC;
    padding: 15px 20px;
    border-radius: 16px;
    margin-top: auto; /* Push to bottom */
    margin-bottom: 20px;
}

.stat-box small {
    color: #A3AED0;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 4px;
}

.stat-box strong {
    color: #1B2559;
    font-size: 1.1rem;
    font-weight: 700;
}

.btn-select {
    width: 100%;
    border-radius: 50px;
    padding: 12px;
    font-weight: 700;
    border: 2px solid #F4F7FE;
    background: transparent;
    color: var(--primary-color);
    transition: 0.3s;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.btn-select:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(108, 93, 211, 0.25);
}

/* Profile Image */
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================
   5. CONSISTENT BUTTON STYLES
   ========================================= */
.btn-primary, .btn-purple {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    border-radius: 50px !important; /* Pill shape for consistency */
    padding: 12px 25px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 10px rgba(108, 93, 211, 0.3) !important;
    transition: all 0.3s ease !important;
    font-size: 1rem !important;
}

.btn-primary:hover, .btn-purple:hover {
    background-color: #5a4cb4 !important; /* Slightly darker purple */
    border-color: #5a4cb4 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 93, 211, 0.4) !important;
}

.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    border-radius: 50px !important;
    font-weight: 600 !important;
    padding: 10px 25px !important;
    font-size: 1rem !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Override Bootstrap default button radius if needed globally */
.btn {
    border-radius: 50px; /* Default to pill shape for all buttons */
}

/* Update Schema Link Style */
.nav-link.text-warning {
    color: #FF754C !important; /* Secondary Orange Color */
}
.nav-link.text-warning:hover {
    color: #e05d35 !important;
    background: rgba(255, 117, 76, 0.1);
}
