:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-dark: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-light: #0f172a;
    --text-muted: #64748b;
    --border: rgba(15, 23, 42, 0.08);
    --success: #10B981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Glassmorphism Blobs */
.background-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.15;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4F46E5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #EC4899;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 30px) scale(1.1); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

p {
    color: var(--text-muted);
    font-size: 14px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 14px 16px;
    color: #0f172a;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.outline-btn {
    width: auto;
    margin-top: 0;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
}

.outline-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.switch-auth {
    text-align: center;
    margin-top: 25px;
    font-size: 13px;
}

.switch-auth a {
    color: #60A5FA;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.switch-auth a:hover {
    color: white;
    text-decoration: underline;
}

/* Dashboard Layout */
.dashboard-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-dark);
    position: relative;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 32px;
    background: transparent;
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.profile-menu {
    position: relative;
}

.profile-btn {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-light);
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.profile-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dropdown-content {
    position: absolute;
    right: 0;
    top: 45px;
    background: #ffffff;
    min-width: 250px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 101;
    overflow: hidden;
}

.dropdown-header {
    padding: 10px 15px;
    background: rgba(0,0,0,0.02);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.dropdown-form {
    padding: 15px;
}

.dropdown-form label {
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.dropdown-form input {
    margin-bottom: 10px;
    padding: 8px;
    font-size: 0.9rem;
}

.dropdown-form button {
    padding: 8px;
    font-size: 0.9rem;
}

.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    padding: 28px 32px 120px 32px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 18px 18px 120px 18px;
    }
}

.upcoming-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.upcoming-item .icon {
    margin-right: 8px;
}

.upcoming-item .badge {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.dashboard-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Deployments Grid */
.deployments-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

.deployment-item {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.deployment-item:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: rgba(79, 70, 229, 0.4);
}

.deployment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.deployment-domain {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.delete-btn {
    width: auto;
    margin-top: 0;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

.cred-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-family: monospace;
    font-size: 0.95rem;
    background: rgba(0,0,0,0.02);
    padding: 8px 12px;
    border-radius: 4px;
}

.cred-label {
    color: #64748b;
    width: 160px;
}

.cred-val {
    flex: 1;
    color: #0f172a;
}

.cred-val.masked {
    letter-spacing: 2px;
}

.copy-btn {
    width: auto;
    margin-top: 0;
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    color: #475569;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: rgba(0,0,0,0.05);
}

/* Modals */
.background-elements {
    pointer-events: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    z-index: 1001;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 15px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.close-modal {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    width: auto;
    margin-top: 0;
    transition: color 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.close-modal:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input {
    margin: 0;
    width: auto;
}

.checkbox-group label {
    margin: 0;
    font-size: 0.9rem;
    color: #475569;
}

.db-select {
    width: 100%;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #0f172a;
    font-size: 1rem;
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

#loadingState {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.terminal-logs {
    background: #000;
    width: 100%;
    height: 150px;
    border-radius: 8px;
    margin-top: 20px;
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    color: #4ADE80;
    text-align: left;
    overflow-y: auto;
    border: 1px solid var(--border);
}

/* Success State */
#successState {
    text-align: center;
}

.success-icon {
    width: 60px;
    height: 60px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    margin: 0 auto 20px;
}

.credentials-box {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    text-align: left;
    border: 1px solid var(--border);
}

.credentials-box h4 {
    color: var(--primary);
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 12px;
    text-transform: uppercase;
}

.credentials-box h4:first-child {
    margin-top: 0;
}

.credentials-box p {
    color: white;
    font-size: 14px;
    margin-bottom: 5px;
}

.credentials-box a {
    color: #60A5FA;
    text-decoration: none;
}

.secret-text {
    font-family: monospace;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.logo {
    position: fixed;
    bottom: 16px;
    left: 16px;
    height: 100px;
    width: auto;
    z-index: 1050;
    pointer-events: none;
    opacity: 0.85;
}

/* Tap-away backdrop behind the Account bottom-sheet on mobile */
.profile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.profile-backdrop:not(.hidden) {
    display: block;
}

/* On desktop the backdrop should never be visible */
@media (min-width: 601px) {
    .profile-backdrop {
        display: none !important;
    }
}

.floating-profile {
    /* Now inside top-nav — no longer needs absolute positioning */
    position: relative;
    top: auto;
    right: auto;
    z-index: 100;
}


.tab-btn {
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(0, 0, 0, 0.03) !important;
}

.tab-btn.active:hover {
    background: #ffffff !important;
}

/* File Manager custom styles */
.fm-file-row {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}
.fm-file-row:hover {
    background: rgba(0, 0, 0, 0.03);
}
.fm-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light) !important;
}
.fm-item-name:hover {
    color: var(--primary) !important;
}
.fm-action-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}
.fm-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}
.fm-action-btn.delete {
    color: var(--danger);
}
.fm-action-btn.delete:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* ===================================================
   MOBILE RESPONSIVE — Dashboard (style.css)
   =================================================== */

/* Tablets and large phones */
@media (max-width: 900px) {
    .top-nav {
        padding: 12px 20px;
    }
    .floating-profile {
        top: 14px;
        right: 16px;
    }
    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 16px 16px 120px 16px; /* keep bottom clearance for logo */
    }
}

/* Mobile phones */
@media (max-width: 600px) {
    /* Nav bar */
    .top-nav {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .nav-brand {
        font-size: 1rem;
    }
    /* profile-menu is now inline in top-nav — no override needed */
    .profile-btn {
        width: 100%;
        text-align: left;
    }
    .dropdown-content {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
        min-width: unset;
    }

    /* Dashboard cards */
    .dashboard-card {
        padding: 18px;
    }
    .dashboard-content {
        padding: 12px 12px 120px 12px; /* keep bottom clearance for logo */
        gap: 14px;
    }

    /* Deployment cards */
    .deployment-item {
        padding: 16px;
    }
    .deployment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .deployment-domain {
        font-size: 1rem;
        word-break: break-all;
    }
    .delete-btn {
        align-self: flex-end;
    }

    /* Credential rows — stack vertically */
    .cred-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 0.85rem;
    }
    .cred-label {
        width: auto;
        font-size: 0.8rem;
    }
    .cred-val {
        word-break: break-all;
        font-size: 0.82rem;
    }
    .copy-btn {
        align-self: flex-end;
        padding: 4px 10px;
    }

    /* File manager table horizontal scroll */
    .modal-content {
        width: 95vw !important;
        max-width: unset !important;
        padding: 16px !important;
        border-radius: 10px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    #fileManagerModal table,
    #fileManagerModal thead,
    #fileManagerModal tbody,
    #fileManagerModal th,
    #fileManagerModal td,
    #fileManagerModal tr {
        display: block;
    }
    #fileManagerModal thead tr {
        display: none; /* hide header on tiny screens */
    }
    #fileManagerModal .fm-file-row td {
        border: none;
        padding: 4px 0;
        font-size: 0.82rem;
        word-break: break-all;
    }
    #fileManagerModal .fm-file-row td:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Logo in dashboard */
    .logo {
        height: 100px;
        bottom: 10px;
        left: 10px;
    }

    /* Modals base */
    .modal-overlay {
        align-items: flex-end;
    }

    /* Tab bar wrapping */
    .tab-btn {
        font-size: 0.8rem;
        padding: 6px 10px !important;
    }

    /* Backups Modal Mobile Adjustments */
    .backups-left-col,
    .backups-right-col {
        min-width: unset !important;
        width: 100% !important;
    }

    #backupsListContainer table,
    #backupsListContainer thead,
    #backupsListContainer tbody,
    #backupsListContainer th,
    #backupsListContainer td,
    #backupsListContainer tr {
        display: block;
    }
    #backupsListContainer thead tr {
        display: none; /* Hide header on mobile */
    }
    #backupsListContainer tr {
        border-bottom: 1px solid var(--border);
        padding: 10px 0;
    }
    #backupsListContainer td {
        display: block;
        width: 100% !important;
        padding: 4px 12px !important;
        box-sizing: border-box;
    }
    #backupsListContainer td:last-child {
        display: flex;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 8px;
    }
}

/* Custom Premium Toggle Switch Component */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .slider {
    background-color: var(--primary);
}
input:checked + .slider:before {
    transform: translateX(20px);
}
