/*
 * Cloudflare Management Panel
 * Theme: exploit.team terminal-inspired dark theme
 * Minimalist, monochrome aesthetic
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0d0d0d;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-card: #111111;
    --panel: #1e1e1e;
    --border: #2a2a2a;
    --border-light: #333333;
    --border-hover: #444444;
    --text: #cccccc;
    --text-bright: #ffffff;
    --text-muted: #888888;
    --text-dim: #555555;
    --accent: #666666;
    --accent-hover: #888888;
    --font-mono: "SF Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
    
    /* Status colors */
    --success: #28ca41;
    --warning: #ffbd2e;
    --danger: #ff5f57;
    --info: #888888;
    
    --sidebar-width: 240px;
    --radius: 4px;
    --radius-lg: 8px;
}

::selection {
    background: #444;
    color: #fff;
}

html {
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(135deg, #0d0d0d 0%, #141414 50%, #0d0d0d 100%);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Grid Background Overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Subtle Glow */
body::after {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(60,60,60,0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text-bright);
}

/* ========== APP LAYOUT ========== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}


/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(13, 13, 13, 0.95);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.logo::before {
    content: "$ ";
    color: var(--text-dim);
}

.logo i {
    color: var(--text-muted);
}

.nav-menu {
    list-style: none;
    padding: 12px 0;
}

.nav-section {
    padding: 16px 20px 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.nav-item {
    margin: 2px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 12px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.nav-link.active {
    background: var(--border-light);
    color: var(--text-bright);
    border-color: var(--border-hover);
}

.nav-link i {
    width: 16px;
    text-align: center;
    font-size: 12px;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: calc(100vh - 100px); /* Leave room for footer */
}

.main-content.full-width {
    margin-left: 0;
}

/* ========== FOOTER - ALWAYS AT BOTTOM ========== */
.panel-footer {
    width: 100%;
    margin-left: var(--sidebar-width);
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    box-sizing: border-box;
}

.main-content.full-width ~ .panel-footer {
    margin-left: 0;
}

/* ========== PAGE HEADER ========== */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.page-header h1::before {
    content: "# ";
    color: var(--text-dim);
}

.page-header h1 i {
    margin-right: 10px;
    color: var(--text-muted);
}

.page-header p {
    color: var(--text-dim);
    font-size: 13px;
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title::before {
    content: "> ";
    color: var(--text-dim);
}

.card-title i {
    color: var(--text-muted);
}

/* ========== GRID ========== */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
}

/* ========== PURGE CARDS ========== */
.purge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.purge-card {
    padding: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.purge-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.purge-input-group input {
    flex: 1;
}

/* ========== STAT CARDS ========== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-dim);
    font-size: 11px;
    text-transform: lowercase;
    letter-spacing: 0.1em;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius);
}

.btn:hover {
    border-color: var(--border-hover);
    background: rgba(255,255,255,0.02);
    color: var(--text);
}

.btn-primary {
    background: var(--border-light);
    color: var(--text);
    border-color: var(--border-hover);
}

.btn-primary:hover {
    background: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-light);
    color: var(--text);
    background: var(--bg-tertiary);
}

.btn-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(255, 95, 87, 0.1);
}

.btn-success {
    border-color: var(--success);
    color: var(--success);
}

.btn-success:hover {
    background: rgba(40, 202, 65, 0.1);
}

.btn-warning {
    border-color: var(--warning);
    color: var(--warning);
}

.btn-warning:hover {
    background: rgba(255, 189, 46, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-light);
    background: var(--bg-secondary);
}

.form-control::placeholder {
    color: var(--text-dim);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ========== TABLES ========== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-tertiary);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.table tr:hover {
    background: rgba(255,255,255,0.02);
}

.table .actions {
    display: flex;
    gap: 6px;
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid;
}

.badge-success {
    background: rgba(40, 202, 65, 0.1);
    color: var(--success);
    border-color: rgba(40, 202, 65, 0.3);
}

.badge-warning {
    background: rgba(255, 189, 46, 0.1);
    color: var(--warning);
    border-color: rgba(255, 189, 46, 0.3);
}

.badge-danger {
    background: rgba(255, 95, 87, 0.1);
    color: var(--danger);
    border-color: rgba(255, 95, 87, 0.3);
}

.badge-info {
    background: rgba(136, 136, 136, 0.1);
    color: var(--text-muted);
    border-color: rgba(136, 136, 136, 0.3);
}

.badge-primary {
    background: rgba(102, 102, 102, 0.1);
    color: var(--text);
    border-color: var(--border-light);
}

/* ========== ALERTS ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    border: 1px solid;
}

.alert-success {
    background: rgba(40, 202, 65, 0.05);
    border-color: rgba(40, 202, 65, 0.2);
    color: var(--success);
}

.alert-warning {
    background: rgba(255, 189, 46, 0.05);
    border-color: rgba(255, 189, 46, 0.2);
    color: var(--warning);
}

.alert-danger {
    background: rgba(255, 95, 87, 0.05);
    border-color: rgba(255, 95, 87, 0.2);
    color: var(--danger);
}

.alert-info {
    background: rgba(136, 136, 136, 0.05);
    border-color: rgba(136, 136, 136, 0.2);
    color: var(--text-muted);
}

/* ========== LOGIN PAGE ========== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    justify-content: center;
    font-size: 20px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-dim);
    font-size: 12px;
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: all 0.3s ease;
    box-shadow: 0 25px 80px rgba(0,0,0,0.5);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.modal-header h3::before {
    content: "> ";
    color: var(--text-dim);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========== TOGGLE SWITCH ========== */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 24px;
    transition: 0.3s;
    border: 1px solid var(--border);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
    border-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background: var(--text-bright);
}

/* ========== LOADING SPINNER ========== */
.spinner {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-top-color: var(--text-muted);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 13, 13, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

/* ========== CODE BLOCK ========== */
.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    overflow-x: auto;
    color: var(--text);
    line-height: 1.8;
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--text-bright);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--text);
}

.tab-content {
    display: none;
}

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

/* ========== DOCUMENTATION ========== */
.doc-section {
    margin-bottom: 40px;
}

.doc-section h2 {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.doc-section h2::before {
    content: "## ";
    color: var(--text-dim);
}

.doc-section h3 {
    font-size: 1rem;
    font-weight: 500;
    margin: 24px 0 12px;
    color: var(--text);
}

.doc-section h3::before {
    content: "### ";
    color: var(--text-dim);
}

.doc-section h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 16px 0 8px;
    color: var(--text-muted);
}

.doc-section p {
    margin-bottom: 12px;
    color: var(--text-muted);
    line-height: 1.7;
}

.doc-section ul, .doc-section ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.doc-section li {
    margin-bottom: 6px;
    color: var(--text-muted);
}

.doc-section code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--text);
}

/* ========== UTILITY CLASSES ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ========== TERMINAL WINDOW STYLE ========== */
.terminal-window {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.5);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot:nth-child(1) { background: #ff5f57; }
.terminal-dot:nth-child(2) { background: #ffbd2e; }
.terminal-dot:nth-child(3) { background: #28ca41; }

.terminal-title {
    margin-left: auto;
    margin-right: auto;
    padding-right: 36px;
    color: var(--text-dim);
    font-size: 11px;
}

.terminal-body {
    padding: 20px;
    font-size: 12px;
    line-height: 1.8;
}

/* Footer content styles (base styles defined above in MAIN CONTENT section) */
.panel-footer .footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.panel-footer .footer-content span {
    display: inline-block;
    text-align: center;
}

.panel-footer .footer-divider {
    color: var(--border);
}

.panel-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.panel-footer a:hover {
    color: var(--text);
    text-decoration: underline;
}

/* ========== MOBILE RESPONSIVE ========== */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mobile-menu-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

/* App container fix for mobile to prevent flex layout issues */
@media (max-width: 768px) {
    .app-container {
        display: block !important;
        flex-direction: column !important;
    }
}

@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Sidebar behavior */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3) !important;
        width: 280px !important;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Main content adjustments */
    .main-content {
        margin-left: 0 !important;
        padding: 70px 15px 20px !important; /* Top padding to avoid menu button overlap */
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        display: block !important;
        position: relative !important;
    }

    .main-content.full-width {
        padding: 20px 15px !important;
        width: 100% !important;
    }
    
    /* Grid layouts - force single column on mobile */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        width: 100% !important;
    }

    /* Flex layouts - stack on mobile */
    .flex {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 10px !important;
    }

    .flex.gap-1,
    .flex.gap-2 {
        gap: 10px !important;
    }

    /* Flex items full width */
    .flex > * {
        width: 100% !important;
        flex-shrink: 0 !important;
    }

    .flex > input,
    .flex > .form-control {
        min-height: 50px !important;
    }

    .flex > .btn {
        min-height: 50px !important;
        justify-content: center !important;
    }
    
    .mt-2 {
        margin-top: 15px;
    }
    
    .mt-3 {
        margin-top: 20px;
    }
    
    .mb-2 {
        margin-bottom: 15px;
    }
    
    /* Cards - Mobile - ENHANCED */
    .card {
        margin-bottom: 15px !important;
        border-radius: var(--radius-md) !important;
        padding: 20px 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: block !important;
        position: relative !important;
    }

    .card-header {
        padding: 0 0 15px 0 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .card-body {
        padding: 15px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Form controls - Mobile (larger touch targets) - ENHANCED */
    .form-group {
        width: 100% !important;
        margin-bottom: 15px !important;
        box-sizing: border-box !important;
    }

    .form-control,
    select.form-control,
    input.form-control,
    textarea.form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"] {
        width: 100% !important;
        min-height: 52px !important;
        font-size: 16px !important;
        padding: 14px 16px !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }

    select.form-control {
        padding-right: 45px !important;
        background-position: right 16px center !important;
        min-height: 52px !important;
    }

    /* Zone selector card specifically */
    #zoneSelector {
        width: 100% !important;
        min-height: 54px !important;
        font-size: 16px !important;
        padding: 14px 16px !important;
    }

    /* Buttons - minimum touch target */
    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: 52px !important;
        padding: 14px 18px !important;
        font-size: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
    }
    
    .table {
        min-width: 600px;
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    /* Stat cards */
    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-info h3 {
        font-size: 1.25rem;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Footer - Mobile Fix - SUPER AGGRESSIVE */
    .panel-footer {
        margin-top: 30px !important;
        padding: 20px 15px !important;
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-sizing: border-box !important;
        clear: both !important;
        float: none !important;
    }

    .panel-footer .footer-content {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        gap: 8px !important;
        font-size: 11px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
    }

    .panel-footer .footer-content span {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        margin: 0 auto !important;
    }

    .panel-footer .footer-divider {
        display: none !important;
    }
    
    /* Login box */
    .login-box {
        width: 95%;
        max-width: 350px;
        padding: 30px 20px;
        margin: 20px auto;
    }
    
    /* Page headers */
    .page-header {
        margin-bottom: 20px;
        text-align: center;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    /* Alerts */
    .alert {
        padding: 12px 15px;
        margin-bottom: 15px;
    }
    
    /* Badges */
    .badge {
        font-size: 10px;
        padding: 4px 6px;
    }
    
    /* Button groups */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: 0;
        border-left: 1px solid var(--border);
    }
    
    .btn-group .btn:first-child {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
    
    .btn-group .btn:last-child {
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
    
    /* Navigation menu text */
    .sidebar .nav-link span {
        font-size: 14px;
    }
    
    .sidebar .logo {
        padding: 15px;
    }
    
    .sidebar .logo span {
        font-size: 14px;
    }
    
    /* Zone cards */
    .zone-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .zone-card .zone-info {
        margin-bottom: 10px;
    }
    
    /* DNS forms */
    .dns-form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* Settings sections */
    .settings-section {
        margin-bottom: 20px;
    }
    
    /* API key display */
    .api-key-display {
        word-break: break-all;
        font-size: 12px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .main-content {
        padding: 60px 12px 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .card {
        padding: 18px 14px !important;
        margin-bottom: 15px !important;
        width: 100% !important;
    }

    .card-body {
        padding: 12px 0 !important;
    }

    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        font-size: 15px !important;
        padding: 15px 18px !important;
        min-height: 54px !important;
        width: 100% !important;
    }

    /* Form controls even larger on very small screens */
    .form-control,
    select.form-control,
    input.form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"] {
        min-height: 54px !important;
        font-size: 16px !important;
        padding: 15px 16px !important;
        width: 100% !important;
    }

    #zoneSelector {
        min-height: 56px !important;
        font-size: 16px !important;
        padding: 15px 16px !important;
    }

    .table {
        font-size: 11px;
        min-width: 500px;
    }

    .stat-card {
        padding: 12px;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        top: 10px;
        left: 10px;
    }

    /* Page header smaller */
    .page-header h1 {
        font-size: 1.25rem;
    }

    .page-header p {
        font-size: 12px;
    }

    /* Card title smaller */
    .card-title {
        font-size: 13px;
    }

    /* Footer extra small screens - even more centered */
    .panel-footer {
        padding: 25px 10px !important;
        text-align: center !important;
    }

    .panel-footer .footer-content {
        font-size: 10px !important;
        gap: 10px !important;
    }

    .panel-footer .footer-content span {
        line-height: 1.6 !important;
    }
}

/* ========== ZONE SELECTOR - MOBILE SPECIFIC ========== */
@media (max-width: 768px) {
    /* First card (zone selector) - make it prominent */
    .main-content > .card:first-of-type {
        padding: 20px 16px !important;
        margin-bottom: 20px !important;
    }

    .main-content > .card:first-of-type .card-header {
        padding-bottom: 15px !important;
        margin-bottom: 15px !important;
    }

    .main-content > .card:first-of-type .form-group {
        margin-bottom: 0 !important;
    }

    /* Zone selector dropdown - VERY specific and large */
    #zoneSelector,
    select#zoneSelector,
    .card select.form-control,
    .card .form-group select {
        width: 100% !important;
        min-height: 58px !important;
        height: 58px !important;
        font-size: 17px !important;
        font-weight: 500 !important;
        padding: 16px 50px 16px 18px !important;
        border-radius: 8px !important;
        background-color: var(--bg-tertiary) !important;
        border: 2px solid var(--border-light) !important;
        color: var(--text-bright) !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 16px center !important;
        background-size: 20px !important;
    }

    #zoneSelector:focus,
    select#zoneSelector:focus {
        border-color: var(--accent-hover) !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(102, 102, 102, 0.2) !important;
    }

    /* All select elements on mobile */
    select,
    select.form-control {
        min-height: 54px !important;
        font-size: 16px !important;
        padding: 14px 45px 14px 16px !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 14px center !important;
        background-size: 18px !important;
    }

    /* All input fields */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    input[type="search"],
    input.form-control,
    textarea.form-control {
        min-height: 54px !important;
        font-size: 16px !important;
        padding: 14px 16px !important;
        border-radius: 6px !important;
    }

    /* Card body form groups */
    .card-body .form-group,
    .card .form-group {
        margin-bottom: 16px !important;
    }

    /* Ensure labels are visible */
    .form-label,
    label.form-label {
        font-size: 13px !important;
        margin-bottom: 8px !important;
        display: block !important;
        color: var(--text-muted) !important;
    }

    /* Action buttons in cards */
    .card-header .btn,
    .card-header button {
        min-height: 48px !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
    }

    /* Table action buttons - keep them small */
    .table .btn-sm,
    .actions .btn-sm,
    td .btn-sm {
        min-height: 38px !important;
        min-width: 38px !important;
        width: auto !important;
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
}

/* Extra small - even larger touch targets */
@media (max-width: 480px) {
    #zoneSelector,
    select#zoneSelector {
        min-height: 60px !important;
        height: 60px !important;
        font-size: 18px !important;
        padding: 18px 50px 18px 18px !important;
    }

    select,
    select.form-control {
        min-height: 56px !important;
        font-size: 17px !important;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input.form-control {
        min-height: 56px !important;
        font-size: 17px !important;
    }
}

/* ============================================================
   NUCLEAR MOBILE FIX - OVERRIDES EVERYTHING
   This section MUST be at the end of the file
   ============================================================ */
@media screen and (max-width: 900px) {
    /* Force app container to stack vertically */
    .app-container {
        display: block !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Hide sidebar completely until toggled */
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        transform: translateX(-100%) !important;
        z-index: 9999 !important;
        transition: transform 0.3s ease !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }

    /* Main content - full width, no margin */
    .main-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        margin-left: 0 !important;
        padding: 80px 16px 30px 16px !important;
        box-sizing: border-box !important;
        float: none !important;
        position: relative !important;
    }

    /* FOOTER - Force to bottom center */
    .panel-footer {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        margin-top: 40px !important;
        padding: 25px 16px !important;
        text-align: center !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
        float: none !important;
        clear: both !important;
        box-sizing: border-box !important;
    }

    .panel-footer .footer-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .panel-footer .footer-content span {
        display: block !important;
        text-align: center !important;
    }

    .panel-footer .footer-divider {
        display: none !important;
    }

    /* Mobile menu toggle - MUST BE VISIBLE */
    .mobile-menu-toggle {
        display: flex !important;
        position: fixed !important;
        top: 16px !important;
        left: 16px !important;
        z-index: 10000 !important;
        width: 48px !important;
        height: 48px !important;
        background: #1a1a1a !important;
        border: 1px solid #333 !important;
        border-radius: 8px !important;
        align-items: center !important;
        justify-content: center !important;
        color: #ccc !important;
        font-size: 20px !important;
        cursor: pointer !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.5) !important;
    }

    /* Cards - full width */
    .card {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important;
        padding: 20px 16px !important;
        box-sizing: border-box !important;
    }

    /* Zone selector and all selects - BIG */
    select,
    select.form-control,
    #zoneSelector {
        display: block !important;
        width: 100% !important;
        min-height: 56px !important;
        height: auto !important;
        font-size: 16px !important;
        padding: 16px 48px 16px 16px !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 16px center !important;
    }

    /* All inputs - BIG */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    input[type="search"],
    input.form-control,
    textarea.form-control {
        display: block !important;
        width: 100% !important;
        min-height: 54px !important;
        font-size: 16px !important;
        padding: 14px 16px !important;
        box-sizing: border-box !important;
    }

    /* Form groups */
    .form-group {
        display: block !important;
        width: 100% !important;
        margin-bottom: 16px !important;
    }

    /* Page header */
    .page-header {
        margin-bottom: 24px !important;
    }

    .page-header h1 {
        font-size: 1.5rem !important;
    }
}
