/* ==========================================================================
   2FA Authenticator - Refined Readable Pixel Monochromatic Stylesheet
   ========================================================================== */

/* Color & Aesthetic Tokens */
:root {
    --bg-main: #000000;
    --bg-card: #0a0a0a;
    --bg-input: #121212;
    --border-pixel: #ffffff;
    --border-dim: #333333;
    
    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --text-muted: #888888;
    
    --accent-pixel: #ffffff;
    --accent-invert: #000000;

    --font-pixel-heading: 'Pixelify Sans', sans-serif;
    --font-pixel-mono: 'JetBrains Mono', 'Courier New', monospace;
    --font-body: 'JetBrains Mono', monospace;
}

/* Base Reset & Background Matrix Pattern */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    word-break: break-word;
    border-radius: 0px !important; /* Enforce Sharp Pixel Aesthetic */
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(#222222 1px, transparent 1px),
        radial-gradient(#111111 1px, #000000 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    zoom: 0.7; /* Skala tampilan 70% */
}

code {
    font-family: var(--font-pixel-mono);
    font-size: 1rem;
    color: var(--text-primary);
}

a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

a:hover {
    background-color: #ffffff;
    color: #000000;
}

/* Layout Container */
.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* App Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--border-pixel);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #ffffff;
    box-shadow: 3px 3px 0px #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-title {
    font-family: var(--font-pixel-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand-subtitle {
    font-family: var(--font-pixel-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Pixel Cards */
.card {
    background-color: var(--bg-card);
    border: 2px solid var(--border-pixel);
    box-shadow: 5px 5px 0px #ffffff;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background-color: #121212;
    border-bottom: 2px solid var(--border-pixel);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title {
    font-family: var(--font-pixel-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card-body.padding-0 {
    padding: 0;
}

/* Forms & Inputs */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.btn-form-submit {
    height: 48px;
    min-height: 48px;
    padding: 0 1.15rem;
    font-size: 0.88rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.flex-1 {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-family: var(--font-pixel-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-text, .input-select, .textarea-batch {
    width: 100%;
    background-color: var(--bg-input);
    border: 2px solid var(--border-pixel);
    color: var(--text-primary);
    font-family: var(--font-pixel-mono);
    font-size: 1.05rem;
    padding: 0.65rem 0.85rem;
    min-height: 48px;
    box-shadow: inset 2px 2px 0px #000000;
    transition: all 0.15s ease;
}

.input-select {
    cursor: pointer;
    font-family: var(--font-pixel-mono);
}

.input-text:focus, .input-select:focus {
    outline: none;
    background-color: #1a1a1a;
    border-color: #ffffff;
    box-shadow: 0 0 0 2px #ffffff, inset 2px 2px 0px #000000;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Pixel Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-pixel-heading);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-height: 48px;
    padding: 0.65rem 1.25rem;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 4px 4px 0px #ffffff;
    cursor: pointer;
    user-select: none;
    transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.btn:hover {
    background-color: #ffffff;
    color: #000000;
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #ffffff;
}

.btn:focus-visible {
    outline: 2px dashed #ffffff;
    outline-offset: 4px;
}

.btn-primary {
    background-color: #ffffff;
    color: #000000;
    border-color: #ffffff;
    box-shadow: 4px 4px 0px #888888;
}

.btn-primary:hover {
    background-color: #e5e5e5;
    color: #000000;
    box-shadow: 4px 4px 0px #ffffff;
}

.btn-secondary {
    background-color: #000000;
    color: #ffffff;
    border-color: #ffffff;
}

.btn-icon {
    min-height: 48px;
    width: 48px;
    padding: 0;
}

.btn-lg {
    font-size: 1.1rem;
    padding: 0.85rem 1.5rem;
    width: 100%;
}

.btn-sm {
    min-height: 38px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

/* Result Box Display */
.result-box {
    background-color: #000000;
    border: 2px solid #ffffff;
    box-shadow: 4px 4px 0px #333333;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px dashed #444444;
    padding-bottom: 0.5rem;
}

.result-label {
    font-family: var(--font-pixel-heading);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.badge {
    font-family: var(--font-pixel-heading);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #ffffff;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.code-display-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #0d0d0d;
    padding: 1.25rem 1.5rem;
    border: 2px solid #ffffff;
    box-shadow: inset 2px 2px 0px #000000;
}

.code-digits {
    font-family: var(--font-pixel-mono);
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: #ffffff;
    cursor: pointer;
    user-select: all;
    transition: transform 0.1s ease;
}

.code-digits:hover {
    transform: scale(1.02);
}

/* Countdown Circle Widget */
.timer-widget {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.35s linear;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-dasharray: 138.23;
    stroke-dashoffset: 0;
}

.timer-seconds {
    position: absolute;
    font-family: var(--font-pixel-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
}

/* Admin Tabs & Data Tables */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-pixel);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: #000000;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-family: var(--font-pixel-heading);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.6rem 1rem;
    cursor: pointer;
    box-shadow: 3px 3px 0px #ffffff;
    transition: all 0.1s ease;
}

.tab-btn:hover {
    background-color: #ffffff;
    color: #000000;
}

.tab-btn.active {
    background-color: #ffffff;
    color: #000000;
    box-shadow: inset 2px 2px 0px #000000;
}

/* Token Statistics Header Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    padding: 1.15rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 2px solid var(--border-pixel);
    box-shadow: 4px 4px 0px #ffffff;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-label {
    font-family: var(--font-pixel-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-value {
    font-family: var(--font-pixel-mono);
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.stat-icon {
    font-size: 2.2rem;
    line-height: 1;
    opacity: 0.85;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 380px;
}

/* Pixel Scrollbar for Table Container */
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-left: 1px solid #333333;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #ffffff;
    border: 1px solid #000000;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #cccccc;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-pixel-mono);
    font-size: 1rem;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #333333;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #121212;
    color: #ffffff;
    font-family: var(--font-pixel-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 2px solid #ffffff;
}

.data-table tr:hover td {
    background-color: #1a1a1a;
}

.token-code {
    font-family: var(--font-pixel-mono);
    font-weight: 700;
    font-size: 1.15rem;
    color: #ffffff;
    margin-right: 0.5rem;
}

/* Modal Dialog */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-dialog {
    background-color: #000000;
    border: 3px solid #ffffff;
    box-shadow: 8px 8px 0px #ffffff;
    width: 100%;
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background-color: #121212;
    border-bottom: 2px solid #ffffff;
}

.modal-title {
    font-family: var(--font-pixel-heading);
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.modal-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* App Footer */
.app-footer {
    text-align: center;
    padding: 1rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 4px 4px 0px #ffffff;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-pixel-heading);
    font-size: 0.9rem;
    animation: toastIn 0.2s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-white { color: #ffffff; }



/* ==========================================================================
   Mobile & Tablet Responsive Layout Rules (antislop-layoutmobile)
   ========================================================================== */

@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
    }
    
    .app-container {
        gap: 1.25rem;
    }

    .brand-title {
        font-size: 1.3rem;
    }

    .brand-subtitle {
        font-size: 0.78rem;
    }

    .card-header {
        padding: 0.85rem 1rem;
    }

    .card-title {
        font-size: 1.05rem;
    }

    .card-body {
        padding: 1.25rem 1rem;
    }
}

@media (max-width: 640px) {
    html, body {
        overflow-x: hidden;
    }

    body {
        padding: 0.75rem 0.5rem;
    }

    /* Mobile Header Layout */
    .app-header {
        flex-wrap: nowrap;
        gap: 0.5rem;
        justify-content: space-between;
        align-items: center;
    }

    .brand-icon {
        width: 38px;
        height: 38px;
    }

    .brand-title {
        font-size: 1.15rem;
    }

    .brand-subtitle {
        font-size: 0.72rem;
    }

    /* Admin Tabs Mobile Reflow */
    .admin-tabs {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .tab-btn {
        flex: 1 1 calc(50% - 0.4rem);
        min-height: 44px;
        padding: 0.5rem 0.4rem;
        font-size: 0.78rem;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Form Rows & Inputs Mobile Reflow */
    .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        width: 100%;
    }

    .form-group, .form-group.flex-1 {
        width: 100%;
        min-width: 100%;
    }

    .input-text, .input-select {
        width: 100%;
        font-size: 0.95rem;
        padding: 0.6rem 0.75rem;
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
    }

    .btn-form-submit {
        width: 100%;
    }

    .btn-lg {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
        min-height: 48px;
        width: 100%;
    }

    /* TOTP Code Display on Mobile */
    .code-digits {
        font-size: 2.15rem;
        letter-spacing: 0.15em;
    }

    /* Table Compact Mobile Styling */
    .data-table th, .data-table td {
        padding: 0.65rem 0.6rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .data-table th {
        font-size: 0.75rem;
    }

    /* Toast Container Safety Insets */
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        width: auto;
    }

    .toast {
        font-size: 0.82rem;
        padding: 0.65rem 1rem;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 0.95rem;
    }

    .brand-subtitle {
        display: none; /* Hide subtitle on tiny screens to preserve horizontal space */
    }

    .header-actions {
        width: auto;
        display: flex;
        justify-content: flex-end;
        flex-shrink: 0;
    }

    .header-actions .btn {
        width: auto;
        font-size: 0.75rem;
        padding: 0.35rem 0.55rem;
    }

    .admin-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    /* Reflow Result Box for Smallest Phones */
    .code-display-group {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem 0.75rem;
    }

    .code-digits {
        font-size: 1.85rem;
        letter-spacing: 0.12em;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}

/* Custom Pixel Modal Confirmation Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100vw / 0.7);
    height: calc(100vh / 0.7);
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem;
    animation: fadeIn 0.15s ease-out;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-card {
    background-color: #0a0a0a;
    border: 2px solid #ffffff;
    box-shadow: 6px 6px 0px #ffffff;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    animation: popIn 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px dashed #ffffff;
    padding-bottom: 0.65rem;
}

.modal-title {
    font-family: var(--font-pixel-heading);
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.05em;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.5rem;
}

.modal-close-btn:hover {
    background-color: #ffffff;
    color: #000000;
}

.modal-body {
    color: #e5e5e5;
    font-family: var(--font-pixel-mono);
    font-size: 0.92rem;
    line-height: 1.6;
    padding: 0.5rem 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px dashed #333333;
    padding-top: 0.85rem;
}

.btn-danger {
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #ffffff;
    box-shadow: 3px 3px 0px #888888;
}

.btn-danger:hover {
    background-color: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 3px 3px 0px #ffffff;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}


