/* Star Wars Datapad Rebuild - Launcher & Frame Styling */
/* Exclusively using local fonts from datapad_app/assets/font/ */
@font-face {
    font-family: "MorrisSansCondensedMedium";
    src: url('../assets/font/MorrisSansCondensedMedium.ttf') format("truetype");
}

@font-face {
    font-family: "MorrisSansCondensedLight";
    src: url('../assets/font/MorrisSansCondensedLight.ttf') format("truetype");
}

@font-face {
    font-family: "Aurebesh";
    src: url('../assets/font/AurebeshNeue.ttf') format("truetype");
}

@font-face {
    font-family: "Droidobesh";
    src: url('../assets/font/DroidobeshNeueBeta.ttf') format("truetype");
}

@font-face {
    font-family: "ModeNine";
    src: url('../assets/font/ModeNine.ttf') format("truetype");
}

@font-face {
    font-family: "Akashi";
    src: url('../assets/font/Akashi.ttf') format("truetype");
}

:root {
    --sw-cyan: #00e5ff;
    --sw-cyan-dim: rgba(0, 229, 255, 0.2);
    --sw-amber: #ff9d00;
    --sw-amber-dim: rgba(255, 157, 0, 0.2);
    --sw-red: #ff3344;
    --sw-bg: #06090e;
    --sw-panel-bg: rgba(10, 16, 26, 0.94);
    --sw-border: #1a2c42;
    --sw-font-tech: 'MorrisSansCondensedLight', 'MorrisSansCondensedMedium', sans-serif;
    --sw-font-title: 'MorrisSansCondensedMedium', 'MorrisSansCondensedLight', sans-serif;
    --sw-font-aurebesh: 'Aurebesh', sans-serif;
    --sw-font-mono: 'ModeNine', monospace;
}

body.datapad-body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #181818 0%, #050505 100%);
    font-family: var(--sw-font-tech);
    color: #d0d0d0;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Datapad Device Shell (Desktop Emulation - iPhone 16 Form Factor) --- */
#datapad-phone-frame {
    position: relative;
    height: min(96vh, calc(95vw * (852 / 393)));
    max-height: 96vh;
    aspect-ratio: 393 / 852;
    width: auto;
    max-width: 95vw;
    background: #121212;
    border-radius: 40px;
    box-shadow: 
        0 0 0 4px #2c2c2c,
        0 0 0 8px #080808,
        0 0 30px rgba(0, 0, 0, 0.8),
        0 25px 50px rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-sizing: border-box;
    border: 3px solid #222222;
}

/* Device Top Bezel / Sensor Notch */
.datapad-top-notch {
    height: 28px;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: #888888;
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', var(--sw-font-tech), sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid #1f1f1f;
    z-index: 10;
}

.datapad-top-notch .status-led {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ff2a2a;
    box-shadow: 0 0 6px #ff2a2a, 0 0 10px rgba(255, 42, 42, 0.6);
    animation: blinkLedRed 1.8s infinite;
}

@keyframes blinkLedRed {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.15; transform: scale(0.9); }
}

/* Game Canvas Host inside Phone Frame */
#game-container {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: calc(100% - 28px);
    overflow: hidden;
    background: #000;
}

#game {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

#game canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#three_render_target {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* --- Datapad In-App Hamburger Menu (Decommission Bypass Dialog) --- */
#datapad-hamburger-menu {
    position: absolute;
    top: 28px;
    left: 0;
    width: 100%;
    height: calc(100% - 28px);
    background: rgba(0, 0, 0, 0.65);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-sizing: border-box;
}

#datapad-hamburger-menu.open {
    display: flex;
}

/* Authentic In-Game Datapad Modal (Simulating BaseSWGEDialog & GraphicButton) */
.sw-menu-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: #000000;
    border: 2px solid #ffffff;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 0px;
}

.swgs-theme .sw-menu-card,
.sw-menu-card.swgs-theme {
    border-color: #ffffff;
}

/* Header Bar: Pure Solid White with Bold Black Text and Black Close Button */
.sw-menu-header {
    background: #ffffff;
    border-bottom: none;
    height: 38px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sw-menu-aurebesh {
    font-family: 'Aurebesh', sans-serif;
    font-size: 16px;
    letter-spacing: 2px;
    color: #000000;
    line-height: 1;
    font-weight: 700;
    user-select: none;
}

.sw-menu-close-btn {
    background: transparent;
    border: none;
    color: #000000;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    font-family: sans-serif;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.sw-menu-close-btn:hover {
    opacity: 0.65;
}

.sw-menu-close-btn:active {
    transform: scale(0.9);
}

/* Menu Content & Buttons */
.sw-menu-content {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #000000;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
    box-sizing: border-box;
}

.sw-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #888888;
    margin-top: 5px;
    margin-bottom: 2px;
    text-transform: uppercase;
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
}

.sw-section-line {
    flex: 1;
    height: 1px;
    background: #282828;
}

/* GraphicButton Styles: Rectangular, 2px solid borders, 0px border-radius */
.sw-graphic-btn {
    position: relative;
    background: #383838;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 10px 8px;
    cursor: pointer;
    text-align: center;
    border-radius: 0px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    user-select: none;
    line-height: 1.15;
}

.sw-graphic-btn.full-width {
    width: 100%;
}

.sw-graphic-btn:hover {
    background: #505050;
    border-color: #ffffff;
    color: #ffffff;
}

.sw-graphic-btn:active {
    background: #252525;
}

/* Amber Highlight Button (Faithfully simulating ARCHIVAL OPTIONS in options dialog) */
.sw-graphic-btn.active,
.sw-graphic-btn.amber-highlight {
    background: #000000;
    border: 2.5px solid #ffa000;
    color: #ffa000;
    font-weight: 800;
}

.sw-graphic-btn.active:hover,
.sw-graphic-btn.amber-highlight:hover {
    background: rgba(255, 160, 0, 0.16);
    border-color: #ffb838;
    color: #ffb838;
}

/* Danger Button (e.g. RESET SAVED DATA) */
.sw-graphic-btn.danger {
    background: #000000;
    border: 2px solid #ff4444;
    color: #ff4444;
}

.sw-graphic-btn.danger:hover {
    background: rgba(255, 68, 68, 0.18);
    border-color: #ff6666;
    color: #ffffff;
}

/* Grids for Buttons */
.sw-btn-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.sw-btn-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

/* In-Menu Feedback Toast */
.sw-menu-toast {
    background: #000000;
    border-top: 1px solid #333333;
    color: #ffa000;
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 8px 12px;
    text-align: center;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sw-menu-toast.show {
    display: flex;
}

/* --- Batuu Terminal Clearance Modal --- */
#datapad-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 6, 10, 0.88);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#datapad-modal {
    width: 92%;
    max-width: 480px;
    background: #000000;
    border: 2px solid #ffffff;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    position: relative;
    max-height: 90vh;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 0px;
}

.sw-terminal-header {
    background: #ffffff;
    height: 38px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sw-terminal-title {
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 1.2px;
    color: #000000;
    text-transform: uppercase;
}

.sw-modal-close-btn {
    background: transparent;
    border: none;
    color: #000000;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    font-family: sans-serif;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.sw-modal-close-btn:hover {
    opacity: 0.65;
}

.sw-modal-close-btn:active {
    transform: scale(0.9);
}

.sw-terminal-body {
    padding: 16px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #000000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

/* Archival Notice Box */
.sw-terminal-info-box {
    background: #0a0a0a;
    border: 1px solid #282828;
    border-left: 3px solid #ffffff;
    padding: 10px 12px;
    border-radius: 0px;
    box-sizing: border-box;
}

.sw-info-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.sw-info-icon {
    color: #ffffff;
    font-size: 10px;
}

.sw-info-title {
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.sw-info-body {
    font-family: var(--sw-font-tech);
    font-size: 11px;
    line-height: 1.45;
    color: #a8a8a8;
}

.sw-info-body p {
    margin: 0 0 6px 0;
}

.sw-info-body p:last-child {
    margin-bottom: 0;
}

.sw-info-body strong {
    color: #ffffff;
    font-weight: 600;
}

.sw-info-body em {
    color: #dedede;
    font-style: italic;
}

.sw-info-tag {
    color: #ffffff;
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
    font-weight: 700;
    letter-spacing: 0.8px;
    margin-right: 4px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.modal-label {
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ffffff;
    text-transform: uppercase;
}

.modal-input {
    background: #0a0a0a;
    border: 1.5px solid #333333;
    border-radius: 0px;
    padding: 9px 10px;
    color: #ffffff;
    font-family: 'MorrisSansCondensedMedium', var(--sw-font-tech), sans-serif;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.modal-input:focus {
    border-color: #ffffff;
}

select.modal-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}

select.modal-input option {
    background: #000000;
    color: #ffffff;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-top: 4px;
    border-top: 1px solid #282828;
    padding-top: 14px;
}

.launch-btn {
    background: #000000;
    color: #ffa000;
    font-family: 'MorrisSansCondensedMedium', 'MorrisSans', sans-serif;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: 2.5px solid #ffa000;
    border-radius: 0px;
    padding: 10px 20px;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.launch-btn.full-width {
    width: 100%;
}

.launch-btn:hover {
    background: rgba(255, 160, 0, 0.16);
    border-color: #ffb838;
    color: #ffb838;
}

.launch-btn:active {
    background: #000000;
    transform: scale(0.99);
}

.danger-link {
    color: #e55c6c;
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: var(--sw-font-tech);
    transition: color 0.15s ease;
}

.danger-link:hover {
    color: #ff3344;
}

.modal-actions-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-link-separator {
    color: #444444;
    font-size: 10px;
    user-select: none;
}

.modal-legal-link {
    color: #888888;
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
    font-family: var(--sw-font-tech);
    transition: color 0.15s ease;
}

.modal-legal-link:hover {
    color: #ffffff;
}

.legal-inline-link {
    color: #00e5ff;
    text-decoration: underline;
    transition: color 0.15s;
}

.legal-inline-link:hover {
    color: #80f0ff;
}

.sw-legal-menu-btn {
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    color: var(--sw-cyan);
    border-color: rgba(0, 229, 255, 0.35);
}

.sw-legal-menu-btn:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--sw-cyan);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    #datapad-phone-frame {
        width: 100vw !important;
        height: 100vh !important;
        max-height: none !important;
        aspect-ratio: auto !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }
    .datapad-top-notch {
        display: none;
    }
    #datapad-modal-overlay {
        padding: 10px 8px;
        box-sizing: border-box;
    }
    #datapad-modal {
        width: 96%;
        max-height: 94vh;
        border-width: 1.5px;
    }
    .sw-terminal-header {
        height: 35px;
        padding: 0 12px;
    }
    .sw-terminal-title {
        font-size: 12px;
        letter-spacing: 1px;
    }
    .sw-terminal-aurebesh-banner {
        padding: 4px 10px;
    }
    .sw-terminal-aurebesh {
        font-size: 11px;
        letter-spacing: 1.5px;
    }
    .sw-terminal-subtext {
        font-size: 8px;
        letter-spacing: 0.8px;
    }
    .sw-terminal-body {
        padding: 10px 12px 14px;
        gap: 10px;
    }
    .sw-terminal-info-box {
        padding: 8px 10px;
    }
    .sw-info-header {
        gap: 5px;
        margin-bottom: 4px;
    }
    .sw-info-icon {
        font-size: 9px;
    }
    .sw-info-title {
        font-size: 10px;
        letter-spacing: 1px;
    }
    .sw-info-body {
        font-size: 10px;
        line-height: 1.4;
    }
    .sw-info-body p {
        margin: 0 0 4px 0;
    }
    .modal-field {
        gap: 4px;
    }
    .modal-label {
        font-size: 10px;
        letter-spacing: 0.8px;
    }
    .location-toggle-group {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .location-toggle-btn {
        padding: 7px 8px;
        font-size: 12px;
        letter-spacing: 1px;
    }
    .modal-input {
        padding: 7px 8px;
        font-size: 12px;
    }
    .modal-actions {
        padding-top: 10px;
        margin-top: 2px;
    }
    .launch-btn {
        padding: 8px 18px;
        font-size: 13px;
        letter-spacing: 1.2px;
    }
    .danger-link {
        font-size: 10px;
    }
    .modal-actions-links {
        gap: 5px;
    }
    .modal-legal-link {
        font-size: 10px;
    }
    #datapad-hamburger-menu {
        top: 0;
        height: 100%;
        padding: 8px;
    }
    .sw-menu-card {
        max-width: 95vw;
    }
}

@media (max-height: 720px) {
    #datapad-modal {
        max-height: 96vh;
    }
    .sw-terminal-body {
        padding: 8px 10px 10px;
        gap: 8px;
    }
    .sw-terminal-info-box {
        padding: 6px 8px;
    }
    .sw-info-body {
        font-size: 9.5px;
        line-height: 1.35;
    }
    .sw-terminal-aurebesh-banner {
        padding: 3px 6px;
    }
}
