/* Canadian Palette Color Scheme */
:root {
    --jigglypuff: #ff9ff3;
    --casandora-yellow: #feca57;
    --pastel-red: #ff6b6b;
    --megaman: #48dbfb;
    --wild-caribbean-green: #1dd1a1;
    --lian-hong-lotus-pink: #f368e0;
    --double-dragon-skin: #ff9f43;
    --amour: #ee5a6f;
    --cyanite: #0abde3;
    --dark-mountain-meadow: #10ac84;
    --jade-dust: #00d2d3;
    --joust-blue: #54a0ff;
    --nasu-purple: #5f27cd;
    --light-blue-ballerina: #c8d6e5;
    --fuel-town: #576574;
    --aqua-velvet: #01a3a4;
    --bleu-de-france: #2e86de;
    --bluebell: #341f97;
    --storm-petrel: #8395a7;
    --imperial-primer: #222f3e;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    font-family: 'Saira Semi Condensed', sans-serif !important;
    height: 100%;
}

html {
    overflow-y: hidden;
}

body {
    background: linear-gradient(180deg, #0065b3 0%, #0065b3 30%, #f7e727 100%) !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    font-family: 'Saira Semi Condensed', sans-serif !important;
    overflow-y: hidden;
}

/* Apply font to all elements */
* {
    font-family: 'Saira Semi Condensed', sans-serif !important;
}

/* Override specific elements */
button, input, textarea, select, a, p, h1, h2, h3, h4, h5, h6, div, span, label, li, td, th {
    font-family: 'Saira Semi Condensed', sans-serif !important;
}

.navbar {
    background: #003a70 !important;
    color: white;
    min-height: 4rem;
    position: relative;
    z-index: 100;
}

.navbar a {
    color: white !important;
}

.btn-primary {
    background: #003a70 !important;
    border-color: var(--joust-blue) !important;
    color: white !important;
}

.btn-primary:hover {
    background: #0065b3 !important;
    border-color: var(--bleu-de-france) !important;
}

.btn-secondary {
    background: #003a70 !important;
    border-color: var(--joust-blue) !important;
    color: white !important;
}

.btn-secondary:hover {
    background: #0065b3 !important;
    border-color: var(--bleu-de-france) !important;
}

.btn-accent {
    background: #003a70 !important;
    border-color: var(--joust-blue) !important;
    color: white !important;
}

.btn-accent:hover {
    background: #0065b3 !important;
    border-color: var(--bleu-de-france) !important;
}

.btn-info {
    background: #003a70 !important;
    border-color: var(--joust-blue) !important;
    color: white !important;
}

.btn-info:hover {
    background: #0065b3 !important;
}

.btn-error {
    background: var(--pastel-red) !important;
    border-color: var(--pastel-red) !important;
    color: white !important;
}

.hero {
    background: linear-gradient(135deg, var(--nasu-purple) 0%, var(--bleu-de-france) 50%, var(--joust-blue) 100%) !important;
}

.badge-primary {
    background: var(--joust-blue) !important;
    color: white !important;
}

.alert-success {
    background: var(--wild-caribbean-green) !important;
    color: white !important;
}

.alert-error {
    background: var(--pastel-red) !important;
    color: white !important;
}

.alert-info {
    background: var(--megaman) !important;
    color: white !important;
}

.card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Script formatting */
.script-row {
    font-family: 'Courier New', monospace;
}
.scene-heading {
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 1.5rem;
}
.character {
    text-transform: uppercase;
    margin-left: 30%;
    margin-top: 1rem;
}
.dialogue {
    margin-left: 20%;
    margin-right: 20%;
}
.parenthetical {
    margin-left: 25%;
    margin-right: 30%;
}
.action {
    margin-top: 1rem;
}

/* Make all text non-selectable by default */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow timecode text to be selectable */
.timecode,
[class*="timecode"],
[id*="timecode"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Allow interaction with dropdown menus */
details,
details summary,
details ul,
.dropdown,
.dropdown *,
.menu,
.menu * {
    pointer-events: auto;
}

/* Fix dropdown menu positioning */
.menu details {
    position: relative;
}

.menu details[open] summary ~ * {
    animation: menuSlide 0.2s ease-in-out;
}

@keyframes menuSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu details ul {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 1001;
    min-width: 220px;
    background-color: #222f3e !important;
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 1rem !important;
    list-style: none;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.menu details ul li {
    width: 100%;
    padding: 0.5rem 0;
    list-style: none;
}

.menu details ul li a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
    white-space: nowrap;
    color: white !important;
    text-decoration: none;
    cursor: pointer;
}

.menu details ul li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Prevent horizontal overflow */
* {
    box-sizing: border-box;
}

.navbar,
main,
footer {
    max-width: 100vw;
}

.navbar {
    overflow: visible !important;
    flex-shrink: 0;
}

main {
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
}

footer {
    overflow-x: hidden;
    flex-shrink: 0;
    margin-top: auto !important;
}

/* Force footer height and padding override */
footer.footer {
    height: 100px !important;
    padding: 0 !important;
}

/* Loading Overlay Styles */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-container {
    width: 80%;
    max-width: 500px;
    text-align: center;
}

.loading-bar-wrapper {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #54a0ff 0%, #2e86de 100%);
    width: 0%;
    transition: width 0.2s linear;
    border-radius: 15px;
}

.loading-percentage {
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

/* Hamburger Menu Styles */
.hamburger-menu {
    display: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1000;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Chat Icon Button Styles */
.chat-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0.5rem;
    background-color: #003a70;
    border-radius: 0.5rem;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-icon-button:hover {
    background-color: #0065b3;
    transform: scale(1.05);
}

.chat-icon-button svg {
    color: white;
}

/* Hide chat icon on desktop, show on mobile */
@media (min-width: 769px) {
    .chat-icon-button {
        display: none;
    }
}

/* Mobile scroll behavior */
@media (max-width: 768px) {
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        transition: background-color 0.3s ease, box-shadow 0.3s ease;
        z-index: 1000;
    }
    
    .navbar.scrolled {
        background-color: transparent !important;
        box-shadow: none !important;
    }
    
    /* Override inline styles when scrolled */
    .navbar.scrolled[style*="background-color"] {
        background-color: transparent !important;
    }
    
    .navbar.scrolled .navbar-brand {
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .navbar.scrolled .hamburger-menu {
        background-color: #003a70;
        border-radius: 0.5rem;
        padding: 0.75rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        transition: all 0.3s ease;
    }
    
    .navbar.scrolled .chat-icon-button {
        background-color: #003a70;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    /* Keep hamburger menu on the right when scrolled */
    .navbar.scrolled {
        justify-content: flex-end;
        padding-right: 1rem;
    }
    
    main {
        margin-top: 64px;
        transition: all 0.3s ease;
    }
    
    main.expanded {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin-top: 0;
        z-index: 500;
    }
    
    main.expanded > div {
        padding-top: 64px;
        padding-bottom: 2rem;
    }
    
    footer {
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
    
    footer.hidden-footer {
        transform: translateY(100%);
        opacity: 0;
    }
}

.mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background-color: #003a70;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    z-index: 999;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}

.mobile-menu ul {
    list-style: none;
    padding: 1rem;
    margin: 0;
}

.mobile-menu ul li {
    padding: 0;
    margin: 0;
}

.mobile-menu ul li a,
.mobile-menu ul li button {
    display: block;
    padding: 1rem;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s;
}

.mobile-menu ul li a:hover,
.mobile-menu ul li button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu .submenu {
    background-color: rgba(0, 0, 0, 0.2);
    padding-left: 1rem;
}

.mobile-menu .submenu li a {
    padding: 0.75rem 1rem;
}

@media (max-width: 768px) {
    .hamburger-menu {
        display: block;
    }
    
    .navbar .menu-horizontal {
        display: none;
    }
}

@media (min-width: 769px) {
    .mobile-menu {
        display: none !important;
    }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Better touch targets */
    .btn {
        min-height: 2.5rem;
        padding: 0.5rem 1rem;
    }
    
    /* Better readability */
    body {
        font-size: 16px;
    }
    
    /* Prevent text from being too small */
    .text-xs {
        font-size: 0.75rem;
    }
    
    .text-sm {
        font-size: 0.875rem;
    }
    
    /* Better spacing on mobile */
    .card-body {
        padding: 1rem;
    }
    
    /* Ensure content doesn't overflow */
    .break-words {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    /* Better modal sizing on mobile */
    .modal-box {
        max-width: calc(100vw - 2rem);
        margin: 1rem;
    }
    
    /* Stack badges better on mobile */
    .badge {
        white-space: nowrap;
    }
    
    /* Better tables on mobile */
    table {
        font-size: 0.875rem;
    }
    
    /* Improve form inputs on mobile */
    input, select, textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .navbar {
        min-height: 3.5rem;
    }
    
    .mobile-menu {
        top: 56px;
    }
    
    /* Even better touch targets for small phones */
    .btn-sm {
        min-height: 2rem;
        padding: 0.375rem 0.75rem;
    }
    
    .btn-xs {
        min-height: 1.75rem;
        padding: 0.25rem 0.5rem;
    }
}
