/* --- Variables (WEBBL Official Banana Yellow Palette) --- */
:root {
    --bg: #09090b;
    --bg-card: rgba(250, 204, 21, 0.03);
    --bg-card-hover: rgba(250, 204, 21, 0.07);
    --border: rgba(250, 204, 21, 0.14);
    --border-highlight: rgba(253, 224, 71, 0.35);
    
    --primary: #facc15;
    --primary-hover: #eab308;
    --primary-glow: rgba(250, 204, 21, 0.35);
    
    --accent: #fde047;
    --accent-glow: rgba(253, 224, 71, 0.35);
    
    --danger: #f43f5e;
    --danger-hover: #e11d48;
    
    --purple: #fbbf24;
    
    --text: #fef08a;
    --text-main: #fef08a;
    --text-muted: #a1a1aa;
    
    --font-sans: 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 20px;
    
    --transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base & Reset --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* --- Typography --- */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.875rem; }
.text-accent { color: var(--accent); }

a { color: var(--text); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

/* --- Layout --- */
.layout {
    display: flex;
    height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    background: rgba(10, 10, 15, 0.95);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 40px;
    padding: 0 8px;
}

.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-badge {
    background: rgba(255,255,255,0.1);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    margin-left: auto;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-section {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 12px;
    letter-spacing: 0.05em;
}

.mt-4 { margin-top: 24px; }
.mt-2 { margin-top: 8px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-item i { width: 16px; text-align: center; }

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.avatar-placeholder {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.user-profile img.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 0.9rem; font-weight: 500; }
.user-status { font-size: 0.75rem; }

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.main-content::before {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.05) 0%, rgba(10,10,15,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.file-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid rgba(250, 204, 21, 0.25);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    margin-right: 8px;
    margin-bottom: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.file-preview-chip .btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview-chip .btn-remove-file:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* --- Top Bar --- */
.topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid var(--border);
    background: rgba(10,10,15,0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

/* Global Styled Input Fields */
.input-field, input[type="text"], input[type="password"] {
    background: rgba(12, 12, 18, 0.85) !important;
    border: 1px solid var(--border-highlight) !important;
    color: #fef08a !important;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.input-field:focus, input[type="text"]:focus, input[type="password"]:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 14px var(--primary-glow), inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
    background: rgba(18, 18, 26, 0.95) !important;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.token-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    transition: var(--transition);
}

.token-input-group:focus-within {
    border-color: var(--primary);
}

.token-input-group i { margin: 0 10px; color: var(--text-muted); }

.token-input-group input {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 6px;
    outline: none;
    width: 180px;
    font-family: monospace;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #09090b;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--accent);
    color: #09090b;
    box-shadow: 0 4px 14px var(--primary-glow);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

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

/* --- Views & Glass --- */
.view-content {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

.hidden { display: none !important; }

.glass {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* --- Dashboard --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); border-color: var(--border-highlight); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.accent { background: rgba(16,185,129,0.1); color: var(--accent); }
.stat-icon.purple { background: rgba(168,85,247,0.1); color: var(--purple); }

.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 700; }

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

/* --- Badges --- */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-soon { background: rgba(148,163,184,0.1); color: var(--text-muted); border: 1px solid rgba(148,163,184,0.2); }
.badge-primary { background: rgba(99,102,241,0.1); color: var(--primary); border: 1px solid rgba(99,102,241,0.2); }
.badge-accent { background: rgba(16,185,129,0.1); color: var(--accent); }

/* --- Cocoons Grid --- */
.cocoons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.cocoon-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.cocoon-card:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.cocoon-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.cocoon-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cocoon-title h3 { margin-bottom: 0; font-size: 1.1rem; display: inline-flex; align-items: center; gap: 6px; }
.cocoon-url {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.cocoon-url i { font-size: 0.75rem; }

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--accent);
}
.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-glow);
}

.cocoon-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cocoon-meta-item { display: flex; align-items: center; gap: 6px; }

.cocoon-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* --- Empty States & Loaders --- */
.empty-state {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-icon { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; opacity: 0.5; }
.glow-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 16px;
    filter: drop-shadow(0 0 15px var(--primary-glow));
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- Footer --- */
.app-footer {
    margin-top: auto;
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    z-index: 1;
}

.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }

/* --- Modals --- */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s;
}

.modal-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
    display: flex !important; /* Keep flex for transition, control vis with opacity/pointer */
}

.modal {
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-sm { max-width: 450px; }

.modal-backdrop.hidden .modal { transform: translateY(20px); }

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

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-close:hover { color: var(--text); }

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

/* --- Tables --- */
.table-container { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { background: rgba(255,255,255,0.02); padding: 12px 16px; font-size: 0.8rem; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.data-table td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.01); }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 0.9rem;
}
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed var(--border-highlight);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.file-drop-zone:hover, .file-drop-zone.drop-zone-active {
    border-color: var(--primary);
    background: rgba(250, 204, 21, 0.08);
    box-shadow: 0 0 20px var(--primary-glow);
}

.drop-icon {
    font-size: 2rem;
    color: var(--primary);
}

.drop-text {
    font-weight: 500;
}

/* Deploy Stepper Overlay Box */
.deploy-stepper-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: rgba(9, 9, 11, 0.95);
    border-radius: var(--radius);
    border: 1px solid var(--border-highlight);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(250, 204, 21, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

.deploy-status-badge {
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid var(--border-highlight);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-dot.building {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Delete Option Cards */
.delete-option-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.delete-option-card:hover {
    border-color: var(--border-highlight);
    background: rgba(255, 255, 255, 0.04);
}

.delete-option-card input[type="radio"] {
    margin-top: 4px;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

/* --- Settings Section --- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 28px;
    margin-top: 24px;
}

.settings-card {
    padding: 32px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.settings-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid var(--border-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    flex-shrink: 0;
}

.settings-icon.accent {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
}

.settings-card-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.token-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 8px;
}

.token-input-wrapper .input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1rem;
}

.token-input-wrapper input {
    width: 100%;
    padding: 14px 44px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: monospace;
    font-size: 0.95rem;
    transition: var(--transition);
}

.token-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 16px var(--primary-glow);
}

.btn-toggle-pass {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-toggle-pass:hover {
    color: var(--primary);
}

.scopes-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
}

.scopes-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.badge-scope {
    background: rgba(250, 204, 21, 0.15);
    color: var(--primary);
    border: 1px solid rgba(250, 204, 21, 0.3);
    font-family: monospace;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.settings-actions {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
}

.btn-danger-outline {
    background: rgba(244, 63, 94, 0.05);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

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

.info-value {
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- Toasts --- */
#toast-container {
    position: fixed;
    top: 24px; right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-width: 300px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show { transform: translateX(0); opacity: 1; }
.toast.success i { color: var(--accent); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--primary); }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.toast-msg { font-size: 0.8rem; color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; padding: 12px; border-right: none; border-bottom: 1px solid var(--border); }
    .nav-menu { flex-direction: row; overflow-x: auto; padding-bottom: 8px; }
    .nav-section { display: none; }
    .nav-item { white-space: nowrap; }
    .sidebar-footer { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; gap: 16px; align-items: stretch; padding: 16px; }
    .search-bar { width: 100%; }
    .auth-section { justify-content: space-between; }
}
