/* =========================================
   Theme Variables
   ========================================= */
:root {
    --primary-color: #78254e; /* Deep Maroon/Purple */
    --primary-hover: #5a1a3a;
    --primary-rgb: 120, 37, 78;
    --secondary-color: #f8f9fa;
    --text-color: #333;
}

/* =========================================
   Base Styles
   ========================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fcfcfc;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

main {
    flex: 1;
    padding-top: 80px !important;
    padding-bottom: 80px;
    overflow-x: hidden;
}

.main-content {
    padding-top: 80px !important;
    margin-left: 250px;
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - 120px);
    padding-bottom: 20px;
}

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

/* Faculty content - no sidebar */
.faculty-content {
    padding-top: 80px !important;
    margin-left: 0;
    min-height: calc(100vh - 120px);
    padding-bottom: 20px;
}

.faculty-content .breadcrumb-container {
    margin-left: 0;
    width: 100%;
}

.faculty-navbar {
    left: 0 !important;
    width: 100% !important;
}

/* =========================================
   Theme Utilities
   ========================================= */
.bg-theme { background-color: var(--primary-color) !important; }
.text-theme { color: var(--primary-color) !important; }

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

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

/* =========================================
   Navbar
   ========================================= */
.navbar {
    background-color: var(--primary-color) !important;
    padding: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: auto;
}

.navbar.with-sidebar {
    left: 250px;
    transition: left 0.3s ease;
}

/* Hide sidebar and adjust layout for all student pages */
body:has(.student-page) #sidebar,
body.student-layout #sidebar {
    display: none !important;
    visibility: hidden !important;
}

body:has(.student-page) .main-content,
body.student-layout .main-content {
    margin-left: 0 !important;
}

body:has(.student-page) footer,
body.student-layout footer {
    margin-left: 0 !important;
}

body:has(.student-page) .navbar,
body.student-layout .navbar {
    left: 0 !important;
    width: 100% !important;
}

body:has(.student-page) .navbar .sidebar-toggle,
body.student-layout .navbar .sidebar-toggle {
    display: none !important;
    visibility: hidden !important;
}

/* Fix navbar on student dashboard when sidebar is hidden */
body:has(.student-dashboard-content) .navbar,
.student-dashboard-content ~ .navbar {
    left: 0 !important;
    width: 100% !important;
}

.navbar-brand, .nav-link {
    color: white !important;
    font-size: 0.95rem;
}

.header-logo {
    height: 44px;
    width: auto;
    display: block;
}

.navbar-brand .header-logo {
    height: 36px;
}

.header-logo-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

@media (max-width: 575px) {
    .navbar-brand .header-logo {
        height: 32px;
    }
}

.navbar-nav .nav-link {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
}

.nav-item.active .nav-link {
    font-weight: bold;
}

.logout-btn {
    background-color: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
}

.logout-btn:hover {
    background-color: rgba(255,255,255,0.2);
    color: white;
}

/* =========================================
   Sidebar
   ========================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background-color: var(--primary-color);
    color: white;
    padding-top: 60px;
    z-index: 1020;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

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

.sidebar-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    background-color: var(--primary-hover);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1021;
}

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

.sidebar-menu li { border-bottom: 1px solid rgba(255,255,255,0.1); }

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: var(--primary-hover);
    color: white;
}

.sidebar-menu a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    color: white;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1rem;
}

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

.sidebar-logout-btn i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-toggle { display: none; }

/* =========================================
   Footer
   ========================================= */
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 0;
    font-size: 0.85rem;
    margin-top: auto;
    position: relative;
    width: 100%;
    z-index: 100;
}

.main-content + footer {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

/* =========================================
   Components: Cards, Tables, Breadcrumbs
   ========================================= */
.card-header-theme {
    background-color: white;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
}

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

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    color: #555;
    font-weight: 600;
}

.breadcrumb-container {
    background-color: #e9ecef;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 100;
}

/* Ensure breadcrumb is visible for faculty and other roles */
.main-content .breadcrumb-container {
    margin-left: 0;
    width: 100%;
    position: relative;
}

.breadcrumb-container.student-breadcrumb {
    position: fixed;
    top: 80px; /* Below navbar which is 80px */
    left: 0;
    right: 0;
    z-index: 1020;
    margin-bottom: 0;
    padding: 0.4rem 1.5rem;
    background-color: #f8f9fa;
    height: 40px;
    display: flex;
    align-items: center;
}

.breadcrumb {
    margin-bottom: 0;
    font-size: 0.875rem;
    background-color: transparent;
    padding: 0;
}

.student-breadcrumb .breadcrumb {
    font-size: 0.8rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 0.9rem;
    line-height: 1;
    vertical-align: middle;
    color: #6c757d;
}

.breadcrumb-item {
    font-size: 0.875rem;
}

.student-breadcrumb .breadcrumb-item {
    font-size: 0.8rem;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #495057;
    font-weight: 500;
}

/* =========================================
   Dashboard Specific Styles
   ========================================= */
.stat-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    background: white;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover::after { opacity: 1; }

.stat-card .card-body {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-content { flex: 1; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background-color: rgba(120, 37, 78, 0.1); /* fallback if var calc fails */
    color: var(--primary-color);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.report-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #eee;
    padding: 1.5rem;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    align-items: center;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.report-card:hover {
    background: #fff;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.report-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-right: 1rem;
    transition: all 0.3s ease;
}

.report-card:hover .report-icon {
    background-color: var(--primary-color);
    color: white;
}

.report-info h5 {
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.report-info p {
    color: #95a5a6;
    font-size: 0.8rem;
    margin: 0;
}

.page-header { margin-bottom: 2rem; }
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}
.page-subtitle {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .main-content + footer { margin-left: 0 !important; }
    .navbar.with-sidebar { left: 0 !important; }
    .navbar.with-sidebar + .stats-header { margin-left: 0 !important; }
    .sidebar-toggle { display: block; }
    .sidebar-header { width: 250px; }
    footer .row { flex-direction: column; gap: 8px; }
    footer .col-md-4 { text-align: center !important; }
}

/* Student Dashboard Specific Styles */
.student-dashboard-nav {
    display: none !important;
}

.student-dashboard-main {
    padding-top: 0 !important;
    margin-left: 0 !important;
    padding-bottom: 0 !important;
}

.student-dashboard-main + footer {
    margin-left: 0 !important;
}

/* =========================================
   CAP 2025 Header Styles - Compact Version
   ========================================= */
.cap-header {
    background-color: #ffffff;
    border-bottom: 2px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

/* CAP Logo Image */
.cap-logo-img {
    max-width: 100px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Title and IIM List */
.cap-title {
    color: #2c3e50;
    font-size: 1.1rem;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.cap-iim-list {
    color: #78254e;
    font-size: 1rem;
    line-height: 1.4;
    margin-top: 0.15rem;
    font-weight: 500;
}

/* Contact Information */
.cap-contact {
    text-align: right;
}

.cap-phone {
    color: #0066cc;
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.cap-email-label {
    color: #495057;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.05rem;
    line-height: 1.1;
}

.cap-email-link {
    color: #0066cc;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.3s ease;
}

.cap-email-link:hover {
    color: #004080;
    text-decoration: underline;
}

/* IIM Logos Container - Compact */
.iim-logos-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    background-color: #fafbfc;
}

.iim-logo-item {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    transition: transform 0.2s ease;
}

.iim-logo-item:hover {
    transform: scale(1.05);
}

.iim-logo {
    max-width: 100px;
    max-height: 85px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(0%);
    transition: filter 0.3s ease;
}

.iim-logo-item:hover .iim-logo {
    filter: brightness(1.1);
}

/* CAP Navigation Bar - Compact */
.cap-navbar {
    background-color: var(--primary-color) !important;
    border-top: 1px solid var(--primary-hover);
    border-bottom: 1px solid var(--primary-hover);
    margin-top: 0.25rem;
    position: static;
    box-shadow: none;
    min-height: auto;
}

.cap-navbar .navbar-nav {
    gap: 0;
}

.cap-navbar .nav-link {
    color: #ffffff !important;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem !important;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    position: relative;
}

.cap-navbar .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.15);
    border-bottom-color: #ffffff;
}

.cap-navbar .nav-link.active {
    color: #ffffff !important;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.2);
    border-bottom-color: #ffffff;
}

.cap-navbar .dropdown-menu {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
}

.cap-navbar .dropdown-item {
    color: #495057;
}

.cap-navbar .dropdown-item:hover,
.cap-navbar .dropdown-item.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.cap-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3);
}

.cap-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.cap-navbar .nav-link i {
    font-size: 0.8rem;
}

/* Responsive adjustments for CAP header */
@media (max-width: 991px) {
    .cap-contact {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .cap-logo-img {
        max-width: 90px;
    }
    
    .cap-title {
        font-size: 1.1rem;
    }
    
    .cap-iim-list {
        font-size: 0.9rem;
        color: #78254e;
    }
    
    .cap-phone {
        font-size: 1rem;
    }
    
    .cap-email-label {
        font-size: 0.7rem;
    }
    
    .cap-email-link {
        font-size: 0.8rem;
    }
    
    .cap-navbar .nav-link {
        padding: 0.5rem 1rem !important;
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .cap-navbar .nav-link.active,
    .cap-navbar .nav-link:hover {
        border-left-color: #0066cc;
        border-bottom-color: transparent;
    }
}

@media (max-width: 768px) {
    .iim-logos-container {
        gap: 1.5rem;
        padding: 0.4rem 0;
    }
    
    .iim-logo {
        max-width: 85px;
        max-height: 75px;
    }
    
    .iim-logo-item {
        padding: 0.2rem;
    }
}

@media (max-width: 576px) {
    .cap-header {
        margin-bottom: 0.75rem;
    }
    
    .cap-logo-img {
        max-width: 65px;
    }
    
    .cap-title {
        font-size: 0.9rem;
    }
    
    .cap-iim-list {
        font-size: 0.85rem;
        line-height: 1.3;
        color: #78254e;
    }
    
    .cap-phone {
        font-size: 0.9rem;
    }
    
    .iim-logos-container {
        gap: 1rem;
        padding: 0.4rem 0;
    }
    
    .iim-logo {
        max-width: 70px;
        max-height: 60px;
    }
    
    .iim-logo-item {
        padding: 0.15rem;
        flex: 0 1 calc(25% - 0.3rem);
    }
}

/* UPDATE Ticker */
.ticker-wrapper {
    overflow: hidden;
    position: relative;
    width: 100%;
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
    padding-left: 100%;
    color: #dc3545; /* Red text color */
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

.ticker-wrapper:hover .ticker-content {
    animation-play-state: paused;
}

/* CAP Welcome Section - Compact */
.cap-header + .bg-light {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
}

.cap-header + .bg-light h4 {
    color: #0056b3;
    font-size: 1.2rem;
    letter-spacing: 0.2px;
}

@media (max-width: 768px) {
    .cap-header + .bg-light h4 {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .cap-header + .bg-light h4 {
        font-size: 0.9rem;
    }
}

/* Remove top padding from main when not authenticated (login page) */
body:not(:has(.navbar.navbar-dark)) main {
    padding-top: 0 !important;
}

/* Login page specific adjustments */
body:not(:has(.navbar.navbar-dark)) {
    padding-top: 0;
}

body:not(:has(.navbar.navbar-dark)) main {
    padding-bottom: 40px;
}
