/* File: css/style.css - MOBILE-FIRST RESPONSIVE DESIGN */

/* ===============================================
   MOBILE-FIRST BASE STYLES (320px - 767px)
   Designed for smartphones first, then enhanced
   =============================================== */

/* CSS Variables for responsive scaling */
:root {
    --mobile-padding: 12px;
    --mobile-font-base: 13px;
    --mobile-font-small: 11px;
    --mobile-font-large: 16px;
    --touch-target: 44px; /* Minimum touch target size */
    --border-width: 2px;
    --glow-intensity: 3px;
    --transition-speed: 0.2s;
}

/* Reset and Base Typography - Mobile First */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

html {
    font-size: var(--mobile-font-base);
    -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape */
    -ms-text-size-adjust: 100%;
}

body {
    background: #000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: none;
    min-height: 100vh;
    position: relative;
}

/* Terminal Container - Mobile Optimized */
.terminal-container {
    min-height: 100vh;
    padding: var(--mobile-padding);
    position: relative;
    background: radial-gradient(ellipse at center, #001100 0%, #000 100%);
}

/* Scanlines - Performance optimized for mobile */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0,255,0,0.015) 50%,
        rgba(0,0,0,0.05) 50%
    );
    background-size: 100% 3px;
    pointer-events: none;
    z-index: 1000;
    animation: scanlines 10s linear infinite;
    will-change: transform; /* GPU acceleration */
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* Terminal Header - Mobile Optimized */
.terminal-header {
    text-align: center;
    margin-bottom: 15px;
    padding: 0 10px;
}

.ascii-art {
    color: #00ff00;
    font-size: 6px;
    text-shadow: 0 0 var(--glow-intensity) #00ff00;
    white-space: pre;
    overflow-x: auto;
    max-width: 100%;
    display: block;
}

/* Terminal Content - Mobile First */
.terminal-content {
    width: 100%;
    max-width: 100%;
    padding: 15px;
    border: var(--border-width) solid #00ff00;
    background: rgba(0,10,0,0.9);
    box-shadow: 0 0 15px rgba(0,255,0,0.3);
    border-radius: 4px; /* Slight rounding for mobile friendliness */
}

/* Status Line - Mobile Optimized */
.status-line {
    color: #00ff00;
    padding: 12px;
    margin-bottom: 15px;
    border-left: 3px solid #00ff00;
    background: rgba(0,255,0,0.05);
    font-weight: bold;
    font-size: var(--mobile-font-small);
    animation: pulse 2s infinite;
    word-wrap: break-word;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Form Elements - Touch Optimized */
.form-group {
    margin-bottom: 20px;
}

.terminal-label {
    display: block;
    margin-bottom: 8px;
    color: #00ff00;
    text-transform: uppercase;
    font-size: var(--mobile-font-small);
    letter-spacing: 0.5px;
}

/* Input and Select - Mobile Optimized */
.terminal-input,
.terminal-select {
    width: 100%;
    min-height: var(--touch-target);
    padding: 12px;
    background: #000;
    color: #00ff00;
    border: 1px solid #00ff00;
    font-family: inherit;
    font-size: 16px; /* Prevents zoom on iOS */
    text-transform: uppercase;
    border-radius: 4px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Custom select arrow for mobile */
.terminal-select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2300ff00" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

.terminal-input:focus,
.terminal-select:focus {
    outline: none;
    box-shadow: 0 0 8px rgba(0,255,0,0.6);
    background: rgba(0,255,0,0.05);
}

/* Timeslot Grid - Mobile Optimized */
.timeslot-grid {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #00ff00;
    padding: 10px;
    background: rgba(0,0,0,0.5);
    border-radius: 4px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom Scrollbar for Mobile */
.timeslot-grid::-webkit-scrollbar {
    width: 6px;
}

.timeslot-grid::-webkit-scrollbar-track {
    background: #001100;
    border-radius: 3px;
}

.timeslot-grid::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 3px;
}

/* Timeslot Days - Mobile Layout */
.timeslot-day {
    margin-bottom: 15px;
    border-bottom: 1px dashed #00ff00;
    padding-bottom: 10px;
}

.day-header {
    color: #00ff00;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: var(--mobile-font-small);
}

/* Timeslot Items - Touch Optimized */
.timeslot-item {
    display: inline-block;
    margin: 4px 3px;
    padding: 10px 14px;
    min-height: var(--touch-target);
    min-width: 70px;
    border: 1px solid #00ff00;
    background: #000;
    color: #00ff00;
    cursor: pointer;
    font-size: var(--mobile-font-small);
    transition: all var(--transition-speed);
    text-align: center;
    vertical-align: middle;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
}

.timeslot-item:active:not(.disabled) {
    transform: scale(0.95);
}

.timeslot-item.selected {
    background: #00ff00;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0,255,0,0.8);
}

.timeslot-item.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Terminal Button - Mobile Optimized */
.terminal-button {
    width: 100%;
    min-height: var(--touch-target);
    background: #000;
    color: #00ff00;
    border: 2px solid #00ff00;
    padding: 14px 20px;
    font-family: inherit;
    font-size: var(--mobile-font-base);
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all var(--transition-speed);
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
}

.terminal-button:active:not(:disabled) {
    transform: scale(0.98);
    background: #00ff00;
    color: #000;
}

.terminal-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Queue Info - Mobile Centered */
.queue-info {
    margin-top: 25px;
    padding: 20px;
    border: 2px dashed #00ff00;
    text-align: center;
    animation: fadeIn 0.5s;
    border-radius: 4px;
}

.queue-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.queue-label {
    font-size: var(--mobile-font-small);
    color: #00ff00;
    text-transform: uppercase;
}

.queue-number {
    font-size: 36px;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 0 0 15px #00ff00;
    animation: glow 2s infinite;
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 15px #00ff00; }
    50% { text-shadow: 0 0 25px #00ff00, 0 0 35px #00ff00; }
}

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

/* Terminal Footer - Mobile */
.terminal-footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: #00ff00;
    font-size: var(--mobile-font-small);
    opacity: 0.7;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #00ff00;
    animation: blink 1s infinite;
    font-size: var(--mobile-font-small);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.error {
    color: #ff0000;
    text-shadow: 0 0 5px #ff0000;
}

.success {
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
}

/* Admin Panel - Mobile First */
.admin-container {
    width: 100%;
    padding: 0 10px;
}

/* Admin Tabs - Mobile Horizontal Scroll */
.admin-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #00ff00;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

.tab-button {
    flex: 0 0 auto;
    min-height: var(--touch-target);
    background: #000;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 10px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: var(--mobile-font-small);
    text-transform: uppercase;
    border-radius: 4px;
    transition: all var(--transition-speed);
    white-space: nowrap;
}

.tab-button:active {
    transform: scale(0.95);
}

.tab-button.active {
    background: #00ff00;
    color: #000;
    font-weight: bold;
}

/* Tab Content - Mobile */
.tab-content {
    display: none;
    padding: 15px;
    border: 1px solid #00ff00;
    background: rgba(0,10,0,0.5);
    overflow-x: auto;
    border-radius: 4px;
    -webkit-overflow-scrolling: touch;
}

.tab-content.active {
    display: block;
}

/* Responsive Table for Mobile */
.request-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--mobile-font-small);
}

/* Mobile Table - Card Layout */
@media screen and (max-width: 767px) {
    .request-table thead {
        display: none;
    }
    
    .request-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #00ff00;
        padding: 10px;
        background: rgba(0,20,0,0.5);
        border-radius: 4px;
    }
    
    .request-table td {
        display: block;
        text-align: left;
        padding: 5px 0;
        border: none;
        position: relative;
        padding-left: 40%;
    }
    
    .request-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 35%;
        font-weight: bold;
        text-transform: uppercase;
        color: #00ff00;
        font-size: 10px;
    }
}

/* Action Buttons - Mobile */
.action-buttons {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.btn-grant,
.btn-decline {
    flex: 1;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid #00ff00;
    background: #000;
    color: #00ff00;
    cursor: pointer;
    font-size: var(--mobile-font-small);
    text-transform: uppercase;
    border-radius: 4px;
    transition: all var(--transition-speed);
}

.btn-grant:active {
    background: #00ff00;
    color: #000;
    transform: scale(0.95);
}

.btn-decline:active {
    background: #ff0000;
    color: #fff;
    border-color: #ff0000;
    transform: scale(0.95);
}

/* Login Form - Mobile Centered */
.login-form {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    border: 2px solid #00ff00;
    background: rgba(0,10,0,0.95);
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,255,0,0.4);
}

.login-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: var(--mobile-font-large);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
}

/* ===============================================
   TABLET STYLES (768px - 1023px)
   Progressive enhancement for tablets
   =============================================== */

@media screen and (min-width: 768px) {
    :root {
        --mobile-padding: 20px;
        --mobile-font-base: 14px;
        --mobile-font-small: 12px;
        --mobile-font-large: 20px;
    }
    
    .terminal-container {
        padding: 20px;
    }
    
    .terminal-header {
        margin-bottom: 20px;
    }
    
    .ascii-art {
        font-size: 8px;
    }
    
    .terminal-content {
        max-width: 700px;
        margin: 0 auto;
        padding: 25px;
    }
    
    .timeslot-grid {
        max-height: 350px;
    }
    
    .timeslot-item {
        min-width: 80px;
        padding: 12px 16px;
    }
    
    .queue-number {
        font-size: 48px;
    }
    
    /* Restore table layout for tablets */
    .request-table thead {
        display: table-header-group;
    }
    
    .request-table tbody tr {
        display: table-row;
        margin: 0;
        border: none;
        padding: 0;
        background: none;
    }
    
    .request-table th,
    .request-table td {
        display: table-cell;
        padding: 10px;
        text-align: left;
        border: 1px solid #00ff00;
    }
    
    .request-table td:before {
        display: none;
    }
    
    .request-table th {
        background: rgba(0,255,0,0.1);
        font-weight: bold;
        text-transform: uppercase;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
    }
    
    .login-form {
        max-width: 450px;
        margin: 40px auto;
        padding: 30px;
    }
}

/* ===============================================
   DESKTOP STYLES (1024px+)
   Full enhancement for desktop
   =============================================== */

@media screen and (min-width: 1024px) {
    :root {
        --mobile-font-base: 14px;
        --mobile-font-small: 12px;
        --mobile-font-large: 24px;
    }
    
    .terminal-container {
        padding: 30px;
    }
    
    .ascii-art {
        font-size: 10px;
    }
    
    .terminal-content {
        max-width: 800px;
        padding: 30px;
    }
    
    .timeslot-grid {
        max-height: 400px;
    }
    
    .timeslot-item:hover:not(.disabled) {
        background: #00ff00;
        color: #000;
        box-shadow: 0 0 10px rgba(0,255,0,0.5);
        transform: scale(1.05);
    }
    
    .terminal-button {
        width: auto;
        padding: 12px 30px;
    }
    
    .terminal-button:hover:not(:disabled) {
        background: #00ff00;
        color: #000;
        box-shadow: 0 0 20px rgba(0,255,0,0.7);
        transform: scale(1.02);
    }
    
    .terminal-button:active:not(:disabled) {
        transform: scale(0.98);
    }
    
    .admin-container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .btn-grant:hover {
        background: #00ff00;
        color: #000;
    }
    
    .btn-decline:hover {
        background: #ff0000;
        color: #fff;
        border-color: #ff0000;
    }
    
    .request-table tr:hover {
        background: rgba(0,255,0,0.05);
    }
}

/* ===============================================
   LANDSCAPE ORIENTATION FIXES
   =============================================== */

@media screen and (max-height: 500px) and (orientation: landscape) {
    .terminal-container {
        padding: 10px;
    }
    
    .terminal-header {
        margin-bottom: 10px;
    }
    
    .timeslot-grid {
        max-height: 150px;
    }
    
    .queue-number {
        font-size: 28px;
    }
}

/* ===============================================
   PERFORMANCE OPTIMIZATIONS
   =============================================== */

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (already dark by default) */
@media (prefers-color-scheme: light) {
    /* Keep dark theme even in light mode for terminal aesthetic */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .terminal-content {
        border-width: 3px;
    }
    
    .terminal-button {
        border-width: 3px;
    }
    
    .timeslot-item {
        border-width: 2px;
    }
}