/*
 * MTT - Manage The Tournament
 * Main Dashboard Stylesheet
 * =========================================
 */

/* --- General & Typography --- */
html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Segoe UI', Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #fafafa;
    line-height: 1.6;
    overflow-x: hidden;
}

/* This container holds and centers the image. This part is mostly correct. */
.event-header-image-container {
    width: 100%;
    min-height: 200px; /* A minimum height for the container */
    background-color: #f8f9fa; /* The light grey background */
    border-radius: 0.375rem;
    padding: 1rem; /* Add some padding for small images */

    /* These use Flexbox to perfectly center the image inside */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* This styles the image itself. It's now much simpler. */
.event-header-image {
    /* Let the 'img-fluid' class handle max-width and height: auto. */
    /* We just add a maximum height to constrain tall portrait images. */
    max-height: 300px; 
}

p {
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.7em;
    color: #555;
}

a,
a:hover,
a:focus {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s;
}

.user-code-display {
    letter-spacing: 2px;
    font-family: monospace;
    color: #0d6efd; /* Bootstrap primary color */
}

/* --- Main Layout Wrapper --- */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}


/* --- Sidebar Styling --- */
#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: #2c3e50;
    color: #ecf0f1;
    transition: all 0.3s ease-in-out;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Sidebar Header */
#sidebar .sidebar-header {
    padding: 15px;
    background: #1a252f;
    text-align: center;
}
#sidebar .sidebar-header .sidebar-brand-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
#sidebar .sidebar-header .sidebar-brand-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
#sidebar .sidebar-header img.logo {
    max-width: 80px;
    margin-bottom: 5px;
}
#sidebar .sidebar-header h3 {
    font-size: 1.5rem;
    margin-bottom: 0;
    color: #fff;
}

/* Sidebar Navigation List */
#sidebar ul.components {
    padding: 15px 0;
    border-bottom: 1px solid #3a506b;
    flex-grow: 1; 
}
#sidebar ul p {
    color: #95a5a6;
    padding: 10px 25px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}
#sidebar ul li a {
    padding: 12px 25px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    color: #bdc3c7;
    border-left: 3px solid transparent;
}
#sidebar ul li a:hover {
    color: #fff;
    background: #34495e;
    border-left-color: #3498db;
}
#sidebar ul li.active > a,
#sidebar ul li a[aria-expanded="true"] {
    color: #fff;
    background: #1f2c39;
    border-left-color: #e74c3c;
}
#sidebar ul li a i {
    margin-right: 12px;
    min-width: 20px;
    text-align: center;
}
#sidebar a.disabled-link {
    color: #6a7c8f !important;
    cursor: not-allowed !important;
    background-color: transparent !important;
    border-left-color: transparent !important;
}

/* Submenu Styling */
#sidebar ul ul a {
    font-size: 0.9em !important;
    padding-left: 50px !important;
    background: #23313f;
}

/* CTA Buttons at bottom of sidebar */
#sidebar ul.CTAs {
    padding: 20px;
    flex-shrink: 0;
}
#sidebar ul.CTAs a {
    text-align: center;
    font-size: 0.9em !important;
    font-weight: bold;
    display: block;
    border-radius: 5px;
    margin-bottom: 5px;
}

/* Sidebar Footer (Version Number) */
.sidebar-footer {
    padding: 20px;
    background: #1a252f;
    text-align: center;
    color: #95a5a6;
    flex-shrink: 0;
}


/* --- Sidebar Collapsed State (Desktop Toggle) --- */
/* This is triggered when the .collapsed-lite class is added to #sidebar */
#sidebar.collapsed-lite {
    min-width: 80px;
    max-width: 80px;
    text-align: center;
}
/* Hide the text parts when collapsed */
#sidebar.collapsed-lite .sidebar-header h3,
#sidebar.collapsed-lite ul.components p,
#sidebar.collapsed-lite ul a span,
#sidebar.collapsed-lite .dropdown-toggle::after {
    display: none;
}
/* Adjust logo size */
#sidebar.collapsed-lite .sidebar-header img.logo {
    max-width: 50px;
}
/* Center icons and adjust padding/size */
#sidebar.collapsed-lite ul li a {
    padding: 15px 10px;
    justify-content: center;
}
#sidebar.collapsed-lite ul li a i {
    margin-right: 0;
    display: block;
    font-size: 1.4rem;
}
#sidebar.collapsed-lite ul ul a {
    padding-left: 10px !important;
}
#sidebar.collapsed-lite ul.CTAs {
    padding: 10px;
}


/* --- Main Content Area Styling --- */
#content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.3s;
    background-color: #f4f6f8;
    margin-left: 260px; /* This pushes content to the right of the fixed sidebar */
}
.content-navbar {
    background-color: #fff !important;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
}


/* --- Mobile Overlay Styling --- */
.overlay {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1039; /* Must be lower than #sidebar's z-index */
    opacity: 0;
    transition: all 0.3s ease-in-out;
}
.overlay.active {
    display: block;
    opacity: 1;
}


/* --- Responsive Adjustments for Mobile --- */
@media (max-width: 767.98px) {
    #sidebar {
        /* On mobile, start off-screen */
        margin-left: -260px;
    }
    #sidebar.active {
        /* When active, slide into view */
        margin-left: 0;
    }
    #content {
        /* On mobile, content should take up full width */
        margin-left: 0;
        width: 100%;
    }
    #sidebar.collapsed-lite {
        /* On mobile, ensure 'collapsed-lite' doesn't break the expanded 'active' menu */
        /* Revert to full width when active, even if it was collapsed on desktop */
        min-width: 260px;
        max-width: 260px;
    }
}


/* --- Calendar Specific Tweaks --- */
#calendar {
    max-width: 1100px;
    margin: 0 auto;
}
.fc-event {
    cursor: pointer;
}
.fc-event-main-content {
    display: flex;
    align-items: center;
    overflow: hidden;
    height: 100%;
}
.fc-event-logo {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    flex-shrink: 0;
    border-radius: 3px;
}
.fc-event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- NEW: Event Card Styling --- */

/* This is the main class for our new square card */
.event-card {
    aspect-ratio: 1 / 1; /* This is the magic line that makes the card square! */
    display: flex;       /* Use flexbox for the card's internal layout */
    flex-direction: column; /* Stack children vertically */
}

/* Create a container for the image */
.event-card .card-img-container {
    flex-shrink: 0; /* Prevent the image container from shrinking */
    background-color: #f8f9fa; /* A light grey background for the image area */
    position: relative;
    width: 100%;
    /* Let the image fill about 50-60% of the card's height */
    height: 55%; 
}

/* This rule makes the image fit perfectly without being cropped */
.event-card .card-img-top {
    width: 100%;
    height: 100%;
    object-fit: contain; /* This ensures the whole image is visible, no cropping */
}

/* Make the card body grow to fill the remaining space */
.event-card .card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column; /* Also use flexbox for its own content */
}

/* This pushes the action button to the bottom of the card body */
.event-card .card-body .mt-auto {
    margin-top: auto;
}