/* =========================================================================
   LAYOUT STRUCTURAL DEFINITIONS
   ========================================================================= */
:root {
    --header-height: 60px;
    --sidebar-width: 260px;
    --transition-speed: 0.25s;
    --logo: url('../images/logo.svg');
}

body {
    padding-top: var(--header-height);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.body-wrapper {
  width: 100%;
  height: 100%;
  overflow-y: auto; /* Enables native vertical scrolling */
  -webkit-overflow-scrolling: touch; /* Ensures smooth physics on iOS */
  
  /* Controls standard pull-to-refresh behavior */
  overscroll-behavior-y: auto; 
}

.border-dashed {
    border-style: dashed !important;
}

/* =========================================================================
   NAVBAR BRAND LOGO MECHANICS
   ========================================================================= */
.navbar-logo {
    flex-shrink: 0;
    object-fit: contain;
    transition: filter var(--transition-speed) ease-in-out;
    max-width: 40px;
}

.navbar-logo svg {
  width: 100%;
  height: 100%;
  display: block; /* Removes unwanted inline whitespace */
}

.logo-svg{
    fill:none;
    fill-opacity:1;
    stroke:#000000;
    stroke-linecap:square;
    stroke-miterlimit:4;
    stroke-dasharray:none;
    stroke-opacity:1
}

.logo-hexagon {
    stroke-width:2;
}

.logo-design {
    stroke-width:1.25;
}


/* Brightness inversion forces dark logo white in dark mode styles
   Using this for svg xml files injected into the page */
html[data-bs-theme="dark"] .navbar-logo, html[data-bs-theme="dark"] .main-background {
    filter: brightness(0) invert(1);
}

/* =========================================================================
   COMPACT SYSTEM SWITCH BUTTON OVERRIDES
   ========================================================================= */
.btn-theme, .btn-outline-custom {
    background: transparent;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    transition: all 0.15s ease-in-out;
}

.btn-theme:hover, .btn-theme:focus, .btn-outline-custom:hover, .btn-outline-custom:focus {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

.btn-theme.active, .btn-outline-custom:active {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}


/* =========================================================================
   RESPONSIVE DRAWER IMPLEMENTATIONS LAYOUT
   ========================================================================= */
.custom-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    z-index: 1030;
    transition: left var(--transition-speed) ease-in-out;
}

.custom-sidebar.is-open { left: 0; }

.sidebar-overlay {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1020;
    display: none;
}
.sidebar-overlay.is-open { display: block; }


.main-content-wrapper {
    position: relative;
    height: calc(100vh - var(--header-height)); /* Constrain exactly to viewport remaining space */
    width: 100%;
    transition: margin-left var(--transition-speed) ease-in-out;
}

.main-background {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    height: 100%;
    width: 100%;
}

.main-background svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* THE SCROLL FIX: Solves scrolling issues by making this component 
   the exclusive vertical overflow driver.
*/
.main-content {
    position: relative;
    height: 100%;
    z-index: 1;
    overflow-y: auto;   /* Force scroll bars exclusively when elements drop down low */
    overflow-x: hidden;  /* Deny horizontal shifting completely */
    padding: 1.5rem;
}

/* =========================================================================
   FIXED-WIDTH MAX-4 CARD GRID MANAGEMENT
   ========================================================================= */
.main-tiles {
    display: grid;
    /* Mobile-first default: single column filling full viewport width */
    grid-template-columns: 1fr; 
    gap: 1rem;
    width: 100%;
}

.card-btn-wrapper {
    text-decoration: none !important; /* Strips browser default link styling */
    color: inherit !important;        /* Prevents text from forcing anchor blue colors */
    display: block;
    height: 300px;
    min-width: 0;                     /* Breaks implicit auto-width text locks */
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.main-tiles .main-tile {
    height: 100%;
    width: 100%;
    overflow: hidden;
    word-wrap: break-word;
    cursor: pointer;                 /* Forces click hand indicator globally */
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

/* HOVER FEEDBACK INTERFACES:
   Gently raises the component card scale and enhances shadow intensity on pointer actions.
*/
.card-btn-wrapper:hover {
    transform: translateY(-3px); /* Snappy lift effect */
}

.card-btn-wrapper:hover .main-tile {
    border-color: var(--bs-link-color) !important; /* Subtle tint matching your active theme primary accents */
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important; /* Deepens shadow depth values */
}

/* ACTIVE/CLICK FEEDBACK INTERFACES:
   Slight compression when clicked to register the interaction.
*/
.card-btn-wrapper:active {
    transform: translateY(-1px);
}

.media-tile {
    background-image: url('../images/media.png');
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% 100%;
}

.games-tile {
    background-image: url('../images/games.png');
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

/* Password wrapper container */
.password-field-container {
    position: relative;
}

/* Float the toggle button inside the input field */
.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 0;
    color: var(--bs-secondary-color);
    opacity: 0.6;
    z-index: 10;
    transition: opacity 0.15s ease-in-out, color 0.15s ease-in-out;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus {
    background: transparent;
    color: var(--bs-primary);
    opacity: 1;
    outline: none;
    box-shadow: none;
}




/* Desktop sizing adaptations */
@media (min-width: 768px) {
    .custom-sidebar {
        left: 0 !important;
    }
    .main-content-wrapper {
        width: calc(100% - var(--sidebar-width)); /* Prevent pushing viewport boundaries */
        margin-left: var(--sidebar-width);
        padding: 3rem;
    }
    .main-tiles {
        /* 1. auto-fill forces a strict width (300px) instead of stretching items.
            2. max-width math: (4 columns * 300px) + (3 gaps * 16px/1rem) = 1248px.
              This guarantees a strict maximum limit of 4 columns across broad screens.
        */
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        max-width: 1248px; 
        
        /* Optional: Centers the entire card grid layout group within your main workspace */
        margin: 0 auto; 
    }
}

@media (min-width: 1200px) {
    .main-tiles {
        /* Recalculating max-width for the larger gap setting:
           (4 columns * 300px) + (3 gaps * 24px/1.5rem) = 1272px.
        */
        gap: 1.5rem;
        max-width: 1272px;
    }
}
