/* ========================================
   ROOT VARIABLES (Default/Dark Theme)
   ======================================== */
:root {
    --page-background: hsl(350deg 73.42% 9.54%);
    --page-gradient: linear-gradient(45deg, hsl(350deg 73.42% 9.54%) 0%, hsl(274deg 65.01% 8.29%) 100%);
    --nav-bg: rgb(12, 12, 12);
    --text-color: #fff;
    --button-bg: rgb(58, 58, 58);
    --button-border: #505050;
    --button-hover: #7c7c7c;
}

/* ========================================
   GLOBAL STYLES
   ======================================== */
* {
    box-sizing: border-box;
    min-height: 0px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 400;
}

/* ========================================
   HTML & BODY STYLES
   ======================================== */
html {
    margin: 0px;
    padding: 0px;
    background-color: var(--background-color);
    height: 100svh;
    width: 100svw;
    overflow: hidden;
    color-scheme: dark light;
}

body {
    color: var(--text-color);
    background: var(--page-gradient, var(--page-background));
    color-scheme: dark;

    display: flex;
    flex-direction: column;
    height: 100svh;
    width: 100svw;

    max-width: 100svw;
    max-height: 100svh;
    margin: 0px;
    overflow-y: auto;
    overflow-x: hidden;
}

body nav:nth-child(1) {
    position: static;
    margin-top: 7px;
    width: 100%;
    height: fit-content;
}

/* ========================================
   NAVIGATION STYLES
   ======================================== */

.nav-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: fit-content;

    gap: 10px;
    padding: 5px 20px;
    margin: 0px 10px;
    border-radius: 20px;

    background-color: var(--nav-bg);
    border: solid transparent;
}

/* a element with a text */
.nav-wrapper > .logo {
    display: inline-block;
    font-size: 30px;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
}

.nav-wrapper > .separator {
    position: relative;
    width: 3px;
    height: 50px;
    background-color: var(--text-color);
}

/* this is a wrapper for the buttons */
.nav-wrapper > .buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background-color: var(--nav-bg);
    color: var(--text-color);
    font-size: 20px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.nav-wrapper > .buttons > * {
    display: inline-block;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
    padding: 5px 10px;

    border-radius: 5px;
    background-color: var(--nav-bg);
    outline: none;
    border: 0px;
    position: relative;
}

.nav-wrapper > .buttons > *::before {
    content: "";
    position: absolute;
    height: 4px;
    width: 0px;
    background-color: var(--button-hover);
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 5px;
    z-index: 1;
    transition: .3s all;
}

.nav-wrapper > .buttons > *:hover:not(.selected)::before {
    width: 7%;
}

.nav-wrapper > .buttons > *.selected::before {
    width: 30%;
}

/* ========================================
   PAGE LAYOUT STYLES
   ======================================== */
.page-content {
    position: relative;
    width: 100%;
    height: -webkit-fill-available;
    max-height: calc(100svh - 90px);
    overflow-y: auto;
    overflow-x: hidden;
}

.page-content.full-height {
    height: fit-content;
    overflow-y: visible;
    max-height: none;
}

.page {
    width: 100%;
    height: 90svh;
    min-height: fit-content;
}

/* ========================================
   FLEXBOX UTILITY CLASSES
   ======================================== */

.centered {
    margin-left: auto !important;
    margin-right: auto !important;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-start {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.flex-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.flex-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

/* ========================================
   BUTTON STYLES
   ======================================== */
/* Enhanced Button Styling with CSS Variables */
.page-button, .page-content button {
    /* Default button variables */
    --btn-bg: var(--button-bg);
    --btn-color: var(--text-color);
    --btn-border-color: var(--button-border);
    --btn-hover-bg: var(--button-hover);
    --btn-active-bg: var(--button-hover);
    --btn-transform: translateY(1px);
    
    /* Button styles */
    width: auto;
    height: auto;
    padding: 8px 15px;
    border: 1px solid var(--btn-border-color);
    border-radius: 5px;
    background-color: var(--btn-bg);
    color: var(--btn-color);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.page-button:hover, .page-content button:hover {
    background-color: var(--btn-hover-bg);
}

.page-button:active, .page-content button:active {
    background-color: var(--btn-active-bg);
    transform: var(--btn-transform);
}

/* Primary button */
.page-button.primary, .page-content button.primary {
    --btn-bg: #2c5282; /* Deep blue */
    --btn-border-color: #3182ce;
    --btn-color: white;
    --btn-hover-bg: #2b6cb0;
    --btn-active-bg: #3182ce;
}

/* Secondary button */
.page-button.secondary, .page-content button.secondary {
    --btn-bg: #353535;
    --btn-border-color: #4a5568;
    --btn-color: #f7fafc;
    --btn-hover-bg: #4a5568;
    --btn-active-bg: #4f5b77;
}

/* Success button */
.page-button.success, .page-content button.success {
    --btn-bg: #2c7a7b; /* Teal */
    --btn-border-color: #38b2ac;
    --btn-color: white;
    --btn-hover-bg: #319795;
    --btn-active-bg: #38b2ac;
}

/* Warning button */
.page-button.warning, .page-content button.warning {
    --btn-bg: #c05621; /* Orange */
    --btn-border-color: #dd6b20;
    --btn-color: white;
    --btn-hover-bg: #dd6b20;
    --btn-active-bg: #ed8936;
}

/* Danger button */
.page-button.danger, .page-content button.danger {
    --btn-bg: #c53030; /* Red */
    --btn-border-color: #e53e3e;
    --btn-color: white;
    --btn-hover-bg: #e53e3e;
    --btn-active-bg: #f56565;
}

/* ========================================
   INPUT STYLES
   ======================================== */
.page-content input {
    width: 100%;
    padding: 7px;
    border: 1px solid var(--button-border);
    border-radius: 5px;
    background-color: var(--button-bg);
    color: var(--text-color);
    outline: none;
    font-weight: 400;
}

.page-content input:focus {
    outline: 2px solid var(--button-hover);
    border-color: var(--button-hover);
    box-shadow: 0 0 5px rgba(50, 150, 250, 0.5);
}

/* ========================================
   MEDIA QUERIES
   ======================================== */
/* Override button styles for light mode */
@media (prefers-color-scheme: light) {
    /* ========================================
       ROOT VARIABLES (Light Theme)
       ======================================== */
    :root {
        --page-background: hsl(350deg 73.42% 95%);
        --page-gradient: linear-gradient(45deg, hsl(350deg 73.42% 85%) 0%, hsl(274deg 65.01% 85%) 100%);
        --nav-bg: rgb(240, 240, 240);
        --text-color: #000;
        --button-bg: rgb(225, 225, 225);
        --button-border: #666666;
        --button-hover: #555555;
    }

    /* ========================================
       BUTTON STYLES (Light Theme Overrides)
       ======================================== */
    /* Default button light mode overrides */
    .page-button, .page-content button {
        --btn-bg: var(--button-bg);
        --btn-color: var(--text-color);
        --btn-border-color: var(--button-border);
        --btn-hover-bg: var(--button-hover);
    }
    
    /* Primary button light mode */
    .page-button.primary, .page-content button.primary {
        --btn-bg: #3182ce;
        --btn-border-color: #4299e1;
        --btn-hover-bg: #4299e1;
        --btn-active-bg: #63b3ed;
    }
    
    /* Secondary button light mode */
    .page-button.secondary, .page-content button.secondary {
        --btn-bg: #e2e8f0;
        --btn-border-color: #cbd5e0;
        --btn-color: #2d3748;
        --btn-hover-bg: #cbd5e0;
        --btn-active-bg: #b9c6d8;
    }
    
    /* Success button light mode */
    .page-button.success, .page-content button.success {
        --btn-bg: #38b2ac;
        --btn-border-color: #4fd1c5;
        --btn-hover-bg: #4fd1c5;
        --btn-active-bg: #81e6d9;
    }
    
    /* Warning button light mode */
    .page-button.warning, .page-content button.warning {
        --btn-bg: #dd6b20;
        --btn-border-color: #ed8936;
        --btn-hover-bg: #ed8936;
        --btn-active-bg: #f6ad55;
    }
    
    /* Danger button light mode */
    .page-button.danger, .page-content button.danger {
        --btn-bg: #e53e3e;
        --btn-border-color: #f56565;
        --btn-hover-bg: #f56565;
        --btn-active-bg: #fc8181;
    }
}

@media (prefers-color-scheme: dark) {
    /* ========================================
       ROOT VARIABLES (Dark Theme - Explicit)
       ======================================== */
    :root {
        --page-background: hsl(350deg 73.42% 9.54%);
        --page-gradient: linear-gradient(45deg, hsl(350deg 73.42% 9.54%) 0%, hsl(274deg 65.01% 8.29%) 100%);
        --nav-bg: rgb(12, 12, 12);
        --text-color: #fff;
        --button-bg: rgb(58, 58, 58);
        --button-border: #858585;
        --button-hover: #484848;
    }
}
