/* --- THEMES SYSTEM --- */

:root {
    /* Default Colors (Arch Blue base) */
    --main-color: #1793d1;
}

/* 
   GENERIC BUTTON CLASS: .btn-main
   This class adapts to the 'theme-b' class on the body.
   
   THEME A (Default): Style 4 "Cyber Glass"
   THEME B (theme-b): Style 2 "Tech Clip"
   
   NOTE: We use ::before and ::after pseudo-elements to simulate complex structures 
   without changing the HTML DOM.
*/

.btn-main {
    /* Shared Base */
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    /* Font from Style 4/2 */
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: bold;
    /* Style 2 is bold, Style 4 is normal. We set per theme. */
    text-transform: uppercase;

    /* Variable color fallback */
    color: var(--btn-color, var(--main-color));
}

/* =========================================
   THEME A: CYBER GLASS (Style 4 equivalent)
   ========================================= */
body:not(.theme-b):not(.theme-c) .btn-main {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-left: 1px solid rgba(255, 255, 255, 0.3);

    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: normal;
    /* Style 4 is normal */
    letter-spacing: 1px;
    border-radius: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body:not(.theme-b):not(.theme-c) .btn-main:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--btn-color, var(--main-color));
    box-shadow: 0 0 15px var(--btn-color, var(--main-color)), inset 0 0 10px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 5px var(--btn-color, var(--main-color));
    transform: translateY(-2px);
}

/* Reset pseudo-elements for Theme A if they were set by Theme B logic (transition safety) */
body:not(.theme-b):not(.theme-c) .btn-main::before,
body:not(.theme-b):not(.theme-c) .btn-main::after {
    display: none;
}


/* =========================================
   THEME B: TECH CLIP (Style 2 equivalent)
   Retro Scanline Buttons
   ========================================= */

body.theme-b .btn-main {
    /* Reset Theme A properties */
    background: #33ff33;
    /* Subtle Scanlines Overlay */
    background-image: repeating-linear-gradient(0deg,
            transparent 0px,
            transparent 2px,
            rgba(0, 0, 0, 0.2) 2px,
            rgba(0, 0, 0, 0.2) 4px);
    backdrop-filter: none;
    border-radius: 0;

    /* Text Styles */
    color: black;

    /* Layout */
    display: inline-block;
    padding: 10px 24px;
    margin: 5px;
    border: none;

    /* Font */
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;

    /* Glow */
    box-shadow: 0 0 10px #33ff33;
    transition: all 0.2s;
    cursor: pointer;
}

body.theme-b .btn-main:hover {
    background: white;
    color: black;
    box-shadow: 0 0 15px white;
    text-shadow: none;
}

/* =========================================
   THEME B (Theme B) AND THEME C (Theme C) BUTTONS
   Both use "Tech Clip" (Style 2)
   ========================================= */

/* body.theme-c BUTTONS (Tech Clip Reuse) */
body.theme-c .btn-main {
    /* Reset Theme A properties */
    background: transparent;
    border: none;
    backdrop-filter: none;
    border-radius: 0;
    box-shadow: none;

    /* Style 2 Wrapper Properties */
    filter: drop-shadow(0 0 1px var(--btn-color, var(--main-color)));

    /* Layout */
    margin: 5px;
    padding: 10px 24px;

    /* Font */
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;

    transition: all 0.3s;
}

/* The Button Body (Simulating .btn-tech) */
body.theme-c .btn-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background: rgba(30, 30, 40, 0.95);
    /* Clip Path */
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);

    z-index: -1;
    transition: all 0.3s;
    display: block;
}

/* The Triangle (Simulating .btn-tech-wrapper::after) */
body.theme-c .btn-main::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 6px;
    height: 6px;

    background: var(--btn-color, var(--main-color));
    clip-path: polygon(100% 0, 100% 100%, 0 100%);

    z-index: 1;
    pointer-events: none;
    transition: all 0.3s;
    display: block;
}

/* Hover Effects */
body.theme-c .btn-main:hover {
    filter: drop-shadow(0 0 2px var(--btn-color, var(--main-color))) drop-shadow(0 0 6px var(--btn-color, var(--main-color)));
    transform: none;
    text-shadow: 0 0 8px var(--btn-color, var(--main-color));
}

body.theme-c .btn-main:hover::before {
    background: rgba(255, 255, 255, 0.05);
}


/* =========================================
   MODAL SYSTEM (Unified)
   ========================================= */

/* Generic Modal Container */
.modal-main {
    position: relative;
    width: 600px;
    max-width: 90vw;
    padding: 0;
    margin: auto;

    /* Font Inheritance */
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transition: all 0.3s ease-in-out;
    animation: modalPopIn 0.3s ease-out;
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-main .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* 
   THEME A: CYBER GLASS (Default) 
   matches "Option A2"
*/
body:not(.theme-b):not(.theme-c) .modal-main {
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(0, 243, 255, 0.1);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 243, 255, 0.05),
        0 0 30px rgba(0, 243, 255, 0.05);
    color: #e6e6e6;
}

/* Theme A Header */
body:not(.theme-b):not(.theme-c) .modal-main .modal-header {
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    background: rgba(0, 0, 0, 0.2);
}

/* Theme A Tabs (in Header) */
body:not(.theme-b):not(.theme-c) .modal-main .modal-tabs {
    display: flex;
    height: 100%;
}

body:not(.theme-b):not(.theme-c) .modal-main .modal-tab {
    padding: 0 20px;
    height: 100%;
    background: transparent;
    border: none;
    color: #888;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

body:not(.theme-b):not(.theme-c) .modal-main .modal-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

body:not(.theme-b):not(.theme-c) .modal-main .modal-tab.active {
    color: var(--main-color, #00f3ff);
    border-bottom-color: var(--main-color, #00f3ff);
    background: linear-gradient(180deg, transparent, rgba(0, 243, 255, 0.05));
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

/* Theme A Close Button */
body:not(.theme-b):not(.theme-c) .modal-main .modal-close {
    width: 50px;
    height: 100%;
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

body:not(.theme-b):not(.theme-c) .modal-main .modal-close:hover {
    color: #fff;
}

/* Theme A Body */
body:not(.theme-b):not(.theme-c) .modal-main .modal-body {
    padding: 25px;
}

/* Theme A Scrollbar */
body:not(.theme-b):not(.theme-c) .modal-main .modal-body::-webkit-scrollbar {
    width: 8px;
}

body:not(.theme-b):not(.theme-c) .modal-main .modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

body:not(.theme-b):not(.theme-c) .modal-main .modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.3);
    border-radius: 4px;
}

body:not(.theme-b):not(.theme-c) .modal-main .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 243, 255, 0.6);
}


/* 
   THEME B: RETRO CRT (theme-b)
   matches "Option B2"
*/
body.theme-b {
    --main-color: #33ff33;
}

body.theme-b .modal-main {
    background: #001100;
    border-radius: 20px;
    border: 2px solid #33ff33;
    box-shadow:
        0 0 20px rgba(51, 255, 51, 0.4),
        inset 0 0 50px rgba(51, 255, 51, 0.1);
    color: #33ff33;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* Theme B Header */
body.theme-b .modal-main .modal-header {
    border-bottom: 1px solid #33ff33;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Theme B Tabs */
body.theme-b .modal-main .modal-tab {
    background: transparent;
    border: none;
    color: #008800;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    margin-right: 15px;
    padding: 5px;
}

body.theme-b .modal-main .modal-tab:hover {
    color: #33ff33;
    text-decoration: underline;
}

body.theme-b .modal-main .modal-tab.active {
    color: #33ff33;
    text-decoration: underline;
    text-shadow: 0 0 5px #33ff33;
}

body.theme-b .modal-main .modal-close {
    background: transparent;
    border: none;
    color: #33ff33;
    font-family: inherit;
    font-size: 1.2rem;
    cursor: pointer;
}

body.theme-b .modal-main .modal-close::before {
    content: '[X]';
}

/* Theme B Body */
body.theme-b .modal-main .modal-body {
    padding: 20px;
}

/* Theme B Scrollbar */
body.theme-b .modal-main .modal-body::-webkit-scrollbar {
    width: 12px;
}

body.theme-b .modal-main .modal-body::-webkit-scrollbar-track {
    background: #001100;
    border-left: 1px solid #004400;
}

body.theme-b .modal-main .modal-body::-webkit-scrollbar-thumb {
    background: #003300;
    border: 1px solid #33ff33;
    box-shadow: inset 0 0 5px #33ff33;
}

body.theme-b .modal-main .modal-body::-webkit-scrollbar-thumb:hover {
    background: #005500;
}

/* 
   THEME C: NEON FLUX (theme-c) 
   matches "Option C"
*/
body.theme-c .modal-main {
    background: #080808;
    border: 1px solid var(--main-color, #1793d1);
    box-shadow: 0 0 20px rgba(23, 147, 209, 0.2);
    /* Clipped Corners */
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
    padding: 3px;
    /* Simulates inner border space if needed, or use content */
    font-family: 'Segoe UI', sans-serif;
    color: #ccc;
}

/* Decorative Triangle */
body.theme-c .modal-main::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 15px;
    height: 15px;
    background: var(--main-color, #1793d1);
    clip-path: polygon(0 0, 100% 0, 0 100%);
    pointer-events: none;
    z-index: 10;
}

/* Theme C Header */
body.theme-c .modal-main .modal-header {
    border-bottom: 1px solid var(--main-color, #1793d1);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111;
}

/* Theme C Tabs */
body.theme-c .modal-main .modal-tab {
    background: transparent;
    border: none;
    color: #666;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    margin-right: 15px;
    padding: 5px 10px;
    border-bottom: 2px solid transparent;
    transition: 0.3s;
}

body.theme-c .modal-main .modal-tab:hover {
    color: white;
    text-shadow: 0 0 5px white;
}

body.theme-c .modal-main .modal-tab.active {
    color: white;
    border-bottom: 2px solid var(--main-color, #1793d1);
    text-shadow: 0 0 8px var(--main-color, #1793d1);
}

/* Theme C Close */
body.theme-c .modal-main .modal-close {
    background: transparent;
    border: none;
    color: var(--main-color, #1793d1);
    font-weight: bold;
    cursor: pointer;
}

body.theme-c .modal-main .modal-close::before {
    content: '[CLOSE]';
    margin-right: 5px;
    opacity: 0.7;
}

/* Theme C Body */
body.theme-c .modal-main .modal-body {
    background: #111;
    /* Inner Dark BG */
    padding: 25px;
}

/* Theme C Scrollbar */
body.theme-c .modal-main .modal-body::-webkit-scrollbar {
    width: 6px;
}

body.theme-c .modal-main .modal-body::-webkit-scrollbar-track {
    background: #080808;
}

body.theme-c .modal-main .modal-body::-webkit-scrollbar-thumb {
    background: var(--main-color, #1793d1);
    box-shadow: 0 0 5px var(--main-color, #1793d1);
}


/* 
   LOGIN PAGE FIXED STYLE (Decoupled from Theme)
   Always looks like Theme A (Cyber Glass)
*/
.btn-login-fixed {
    /* Shared Base */
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    text-transform: uppercase;
    color: var(--btn-color, var(--main-color));

    /* Theme A Specifics (Hardcoded) */
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-left: 1px solid rgba(255, 255, 255, 0.3);

    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: normal;
    letter-spacing: 1px;
    border-radius: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-login-fixed:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--btn-color, var(--main-color));
    box-shadow: 0 0 15px var(--btn-color, var(--main-color)), inset 0 0 10px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 5px var(--btn-color, var(--main-color));
    transform: translateY(-2px);
}

/* --- RICH POPUP CONTENT --- */
.rich-popup-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    color: var(--text-color);
}

.popup-header-img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.2);
    border: 1px solid var(--primary-color);
    object-fit: cover;
    max-height: 200px;
}

.popup-section-title {
    font-family: 'Orbitron', 'Segoe UI', sans-serif;
    color: var(--main-color, #00f3ff);
    text-shadow: 0 0 5px var(--main-color, #00f3ff);
    margin: 0;
    font-size: 1.2rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--main-color, #00f3ff);
    padding-bottom: 5px;
}

.popup-description {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #ccc;
}

.popup-description p {
    margin-bottom: 10px;
}

.popup-footer-img {
    width: 100%;
    border-radius: 8px;
    opacity: 0.9;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-cta-btn {
    display: block;
    text-align: center;
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.2), var(--main-color, #00f3ff));
    color: #000;
    font-weight: bold;
    text-decoration: none;
    padding: 12px;
    border-radius: 4px;
    margin-top: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.popup-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--main-color, #00f3ff);
    color: #fff;
    text-shadow: 0 0 5px white;
}