/* ==========================================================================
   BASE STYLE SHEET (base.css)
   ========================================================================== */

/* ==========================================================================
   CSS VARIABLES & DESIGN SYSTEM (Theme Independent Tokens)
   ========================================================================== */
:root {
    /* Color Palette Bases */
    --primary-indigo: #6366f1;
    --primary-purple: #a855f7;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Layout Constants */
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    --border-radius-xl: 28px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-quick: all 0.15s ease;
    
    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   BASE & RESET STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-stack);
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Prevent Viewport Zooming globally in CSS */
html, body, .mobile-app-wrapper, input, button, select, textarea {
    touch-action: manipulation;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   MOBILE SHELL STRUCTURE (Centering and App Simulation)
   ========================================================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-body);
    position: relative;
    overflow: auto;
}

/* Backlighting glow effects for login background */
.login-body::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.login-body::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.mobile-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    z-index: 1;
}

.app-body {
    background-color: #000;
}

.mobile-app-wrapper {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin: 0 auto;
}

/* ==========================================================================
   LOGIN CARD / AUTHENTICATION UI
   ========================================================================== */
.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 36px 28px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: var(--glass-blur);
}

.app-header-logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo-circle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 54px;
    height: 54px;
    background: var(--accent-gradient);
    border-radius: 50%;
    color: white;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.logo-circle svg {
    width: 26px;
    height: 26px;
}

.app-header-logo h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.app-header-logo p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition-quick);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.btn-toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
}

.btn-toggle-password svg {
    width: 18px;
    height: 18px;
}

.btn-toggle-password.active {
    color: var(--accent-color);
}

.form-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2px;
}

.persistent-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--success);
    font-weight: 600;
}

.shield-icon {
    width: 12px;
    height: 12px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-primary {
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--border-radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    padding: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 18px;
    cursor: pointer;
    transition: var(--transition-quick);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger);
    border: none;
    border-radius: var(--border-radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 11px;
    cursor: pointer;
    transition: var(--transition-quick);
}

.btn-danger:hover {
    filter: brightness(1.08);
}

.w-full { width: 100%; }
.mt-4 { margin-top: 16px; }

/* Alerts */
.alert-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    margin-bottom: 20px;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.4;
}

.alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ==========================================================================
   MODAL DIALOGS (Bottom Sheets)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 20;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-sheet {
    width: 100%;
    background: var(--bg-secondary);
    border-top-left-radius: var(--border-radius-lg);
    border-top-right-radius: var(--border-radius-lg);
    padding: 20px;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85%;
    overflow-y: auto;
}

.modal-backdrop.show .modal-sheet {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding-top: 4px;
}

/* settings layouts */
.settings-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    margin-bottom: 16px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.settings-val {
    font-size: 13px;
    font-weight: 600;
}

.badge-success {
    color: var(--success);
    background: rgba(16, 185, 129, 0.08);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.info-alert {
    display: flex;
    gap: 10px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: var(--border-radius-md);
    padding: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.info-alert svg {
    color: var(--accent-color);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* Desktop sizing corrections for app wrapper */
@media (min-width: 768px) {
    .mobile-app-wrapper {
        border-radius: var(--border-radius-lg);
        height: 88vh;
        max-height: 800px;
        margin: 6vh auto 0 auto;
    }
    .modal-sheet {
        border-bottom-left-radius: var(--border-radius-lg);
        border-bottom-right-radius: var(--border-radius-lg);
    }
}

/* ==========================================================================
   DRAG & DROP ZONE AND FILES QUEUE
   ========================================================================== */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-quick);
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.upload-dropzone:hover, 
.upload-dropzone.dragover {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.04);
}

.dropzone-icon {
    width: 40px; /* Constrains giant SVG sizes */
    height: 40px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.upload-dropzone p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.hidden-input {
    display: none;
}

/* Upload Queue */
.upload-queue-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.upload-queue-container h4 {
    font-size: 13px;
    color: var(--text-secondary);
}

.upload-queue {
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    padding: 8px 10px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.queue-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 70%;
}

.queue-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.queue-item-size {
    font-size: 10px;
    color: var(--text-muted);
}

.queue-item-status {
    font-size: 10px;
    font-weight: 600;
}

.queue-item-status.pending { color: var(--text-muted); }
.queue-item-status.uploading { color: var(--accent-color); }
.queue-item-status.success { color: var(--success); }
.queue-item-status.error { color: var(--danger); }

/* Progress Tracks */
.overall-progress-bar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
}

.progress-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    width: 0;
    transition: width 0.1s ease;
}

.modal-footer-actions {
    margin-top: 14px;
}

/* ==========================================================================
   GLOBAL APP LOADER OVERLAY
   ========================================================================== */
.app-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-loader-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.loader-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 24px 32px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.15);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 0.8s linear infinite;
}

#loader-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

