/* ========================================================
   EXACT 1:1 REPLICA OF OFFICIAL GATE VIRTUAL CALCULATOR
   ======================================================== */

.calc-page-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 1rem 0.5rem 1.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Floating Theme Toggle (Zero vertical footprint) */
.floating-theme-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(11, 12, 16, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s, background 0.2s;
}

.floating-theme-btn:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.15);
}

/* Bottom Minimalist Branding */
.calc-footer-brand {
    margin-top: 1rem;
    text-align: center;
    padding-bottom: 0.5rem;
}

.calc-footer-brand .logo {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* =========================================
   DEFAULT: OFFICIAL TCS iON GATE AESTHETICS
   ========================================= */
body.theme-tcs .gate-calc-window {
    background: #d6d6d6;
    border: 1px solid #999999;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    color: #222222;
}

body.theme-tcs .calc-titlebar {
    background: #3876ea;
    color: #ffffff;
    padding: 8px 12px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    font-weight: 500;
}

body.theme-tcs .calc-body {
    padding: 10px 12px 14px 12px;
}

/* Display Boxes */
.display-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

body.theme-tcs .calc-box-top {
    width: 100%;
    height: 32px;
    background: #ffffff;
    border: 1px solid #a6a6a6;
    border-radius: 3px;
    padding: 4px 8px;
    font-family: Arial, sans-serif;
    font-size: 0.95rem;
    color: #444444;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

body.theme-tcs .calc-box-bottom {
    width: 100%;
    height: 42px;
    background: #ffffff;
    border: 1px solid #a6a6a6;
    border-radius: 3px;
    padding: 4px 8px;
    font-family: Arial, sans-serif;
    font-size: 1.7rem;
    font-weight: bold;
    color: #000000;
    text-align: right;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* Row 1: Mod + Deg/Rad + Memory */
.calc-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 6px;
}

.btn-mod {
    width: 48px;
}

.angle-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.mem-group {
    display: flex;
    gap: 5px;
}

.mem-group .btn-calc {
    min-width: 36px;
    padding: 5px 6px;
}

/* 11-Column Grid */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    grid-template-rows: repeat(5, auto);
    gap: 4px;
}

.col-span-2 {
    grid-column: span 2;
}

.row-span-2 {
    grid-row: span 2;
    height: 100%;
}

/* Button Styling */
.btn-calc {
    border-radius: 3px;
    padding: 7px 2px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #aaaaaa;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    transition: background 0.1s, transform 0.05s;
}

.btn-calc:active {
    transform: translateY(1px);
}

body.theme-tcs .btn-normal {
    background: #f7f7f7;
    color: #222222;
    border-color: #ababab;
}

body.theme-tcs .btn-normal:hover {
    background: #e8e8e8;
}

body.theme-tcs .btn-digit {
    font-weight: 700;
    font-size: 0.95rem;
}

/* Red Keys: Arrow, C, +/- */
body.theme-tcs .btn-red {
    background: #d83a2a;
    color: #ffffff;
    border-color: #b32517;
    font-weight: bold;
}

body.theme-tcs .btn-red:hover {
    background: #c32d1e;
}

/* Green Equal Key */
body.theme-tcs .btn-green {
    background: #28a745;
    color: #ffffff;
    border-color: #1e7e34;
    font-size: 1.2rem;
    font-weight: bold;
}

body.theme-tcs .btn-green:hover {
    background: #218838;
}

/* =========================================
   OPTIONAL: VN LABS DARK THEME
   ========================================= */
body.theme-dark .gate-calc-window {
    background: rgba(17, 20, 28, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    color: #ffffff;
    backdrop-filter: blur(16px);
}

body.theme-dark .calc-titlebar {
    background: rgba(0, 229, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 600;
}

body.theme-dark .calc-body {
    padding: 10px 12px 14px 12px;
}

body.theme-dark .calc-box-top {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
}

body.theme-dark .calc-box-bottom {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-light);
    color: var(--cyan);
}

body.theme-dark .btn-normal {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-light);
    color: #ffffff;
}

body.theme-dark .btn-normal:hover {
    background: rgba(255, 255, 255, 0.12);
}

body.theme-dark .btn-red {
    background: rgba(239, 68, 68, 0.8);
    color: #ffffff;
    border-color: #ef4444;
}

body.theme-dark .btn-green {
    background: var(--cyan);
    color: var(--bg-dark);
    border-color: var(--cyan);
}

/* =========================================
   PHONE / MOBILE ONLY: PURE FULLSCREEN CALC
   ========================================= */
@media (max-width: 650px) {
    .calc-page-container {
        padding: 4px 2px 1rem 2px;
        justify-content: flex-start;
    }

    .gate-calc-window {
        width: 100%;
        max-width: 100%;
        border-radius: 4px;
        margin-top: 0;
    }

    .calc-body {
        padding: 6px 4px 8px 4px;
    }

    .calc-grid {
        gap: 2px;
    }

    .btn-calc {
        padding: 8px 1px;
        font-size: 0.72rem;
    }

    .mem-group .btn-calc {
        min-width: 28px;
        padding: 4px 2px;
        font-size: 0.7rem;
    }

    .btn-mod {
        width: 38px;
        font-size: 0.75rem;
    }

    .angle-group {
        font-size: 0.75rem;
        gap: 4px;
    }

    .calc-box-bottom {
        font-size: 1.4rem !important;
        height: 38px;
    }

    .calc-box-top {
        height: 28px;
        font-size: 0.85rem;
    }

    .floating-theme-btn {
        top: 6px;
        right: 6px;
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .calc-footer-brand {
        margin-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

/* ========================================================
   PHONE ROTATED / LANDSCAPE: 100% PURE CALCULATOR ONLY
   Zero margins, zero padding, zero scrolling, fits screen
   ======================================================== */
@media (orientation: landscape) and (max-height: 550px) {
    html, body {
        height: 100vh !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .glow-orb,
    .desktop-only,
    .calc-footer-brand,
    .floating-theme-btn {
        display: none !important;
    }

    .calc-page-container {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        justify-content: stretch !important;
        overflow: hidden !important;
    }

    .gate-calc-window {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100% !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .calc-titlebar {
        padding: 3px 10px !important;
        font-size: 0.85rem !important;
        flex-shrink: 0 !important;
    }

    .calc-body {
        padding: 4px 6px 4px 6px !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        overflow: hidden !important;
    }

    .display-container {
        gap: 2px !important;
        margin-bottom: 2px !important;
        flex-shrink: 0 !important;
    }

    .calc-box-top {
        height: 22px !important;
        font-size: 0.8rem !important;
        padding: 1px 6px !important;
    }

    .calc-box-bottom {
        height: 28px !important;
        font-size: 1.25rem !important;
        padding: 1px 6px !important;
    }

    .calc-row-top {
        margin-bottom: 3px !important;
        flex-shrink: 0 !important;
    }

    .calc-grid {
        flex: 1 !important;
        display: grid !important;
        grid-template-columns: repeat(11, 1fr) !important;
        grid-template-rows: repeat(5, 1fr) !important;
        gap: 2px !important;
    }

    .btn-calc {
        padding: 0 !important;
        height: 100% !important;
        font-size: clamp(0.65rem, 2.3vh, 0.85rem) !important;
        border-radius: 2px !important;
    }
}

