/* ==================== ROOT VARIABLES ==================== */
:root {
    --bg-main: #0a0b10;
    --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --primary-glow: 0 0 15px rgba(0, 242, 254, 0.4);
    
    --success-gradient: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
    --success-glow: 0 0 15px rgba(59, 186, 146, 0.4);
    
    --warning-gradient: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --warning-glow: 0 0 15px rgba(253, 160, 133, 0.4);

    --danger-gradient: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    --danger-glow: 0 0 15px rgba(255, 8, 68, 0.4);
    
    --text-primary: #ffffff;
    --text-secondary: #8e92a4;
    --text-muted: #4e5264;
    
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --glass-blur: blur(20px);
    
    --font-primary: 'Outfit', sans-serif;
}

/* ==================== BASE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Glowing background blobs */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background-color: var(--bg-main);
}

.glass-bg::before, .glass-bg::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
}

.glass-bg::before {
    background-color: #00f2fe;
    top: -100px;
    right: -50px;
    animation: float-blob-1 20s infinite alternate;
}

.glass-bg::after {
    background-color: #ff0844;
    bottom: -100px;
    left: -50px;
    animation: float-blob-2 25s infinite alternate;
}

@keyframes float-blob-1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-80px, 80px) scale(1.2); }
}

@keyframes float-blob-2 {
    0% { transform: translate(0, 0) scale(1.1); }
    100% { transform: translate(80px, -80px) scale(0.9); }
}

/* ==================== LAYOUT & CONTAINER ==================== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 100vh;
}

/* Glass panel style */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* ==================== APP HEADER ==================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
}

.header-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.accent-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==================== STATS OVERVIEW ==================== */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
}

.stat-icon {
    font-size: 2.25rem;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.green {
    background: rgba(59, 186, 146, 0.1);
    border-color: rgba(59, 186, 146, 0.2);
}

.stat-icon.blue {
    background: rgba(0, 242, 254, 0.1);
    border-color: rgba(0, 242, 254, 0.2);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #000;
    box-shadow: var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-gradient);
    color: #fff;
    box-shadow: var(--danger-glow);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(255, 8, 68, 0.6);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* ==================== ACCOUNTS GRID & CARDS ==================== */
.accounts-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    min-height: 200px;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 0.75rem;
}

.empty-icon {
    font-size: 3.5rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 400px;
    font-size: 0.95rem;
}

/* Account Card design */
.account-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.account-card:hover {
    border-color: rgba(0, 242, 254, 0.2);
    transform: translateY(-4px);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.card-title {
    display: flex;
    flex-direction: column;
}

.card-name {
    font-size: 1.15rem;
    font-weight: 600;
}

.card-username {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: rgba(59, 186, 146, 0.15);
    color: #3cba92;
    border: 1px solid rgba(59, 186, 146, 0.3);
    box-shadow: 0 0 10px rgba(59, 186, 146, 0.1);
}

.badge-inactive {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card Info Body */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 0.5rem;
}

.info-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Card Actions */
.card-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: auto;
}

.card-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* ==================== REALTIME LOGS CONSOLE ==================== */
.logs-section {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logs-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.logs-console {
    background: #06070a;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    height: 250px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.log-line {
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line.info { color: #8e92a4; }
.log-line.warning { color: #f6d365; }
.log-line.error { color: #ff0844; }
.log-line.system { color: #00f2fe; }

/* ==================== MODALS & BACKDROP ==================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    background: #12131a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    transition: color 0.2s;
}

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

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input, .form-group textarea {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: rgba(0, 242, 254, 0.5);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.required-badge {
    background: rgba(255, 8, 68, 0.1);
    color: #ff0844;
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    margin-left: 0.25rem;
}

.modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

/* Step Layout Helper */
.auth-step {
    transition: opacity 0.3s ease;
}

.step-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ==================== UTILITIES ==================== */
.hidden {
    display: none !important;
}

/* Spinner for Loading State */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0,0,0,.15);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
}

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

/* ==================== LOGIN WINDOW STYLES ==================== */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.login-container.active {
    opacity: 1;
    pointer-events: auto;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.login-error {
    background: rgba(255, 8, 68, 0.1);
    color: #ff0844;
    border: 1px solid rgba(255, 8, 68, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 1.25rem;
}

.btn-block {
    width: 100%;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.divider:not(:empty)::before {
    margin-right: .75em;
}
.divider:not(:empty)::after {
    margin-left: .75em;
}

/* Card header delete button */
.card-delete-btn {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.card-delete-btn:hover {
    opacity: 1;
}

/* Jobs sub-section inside account cards */
.jobs-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid #00f2fe;
    padding-left: 0.5rem;
}

.jobs-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Scrollbar styling for jobs container */
.jobs-list-container::-webkit-scrollbar {
    width: 4px;
}
.jobs-list-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
.jobs-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.job-empty-state {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem 0;
    background: rgba(255, 255, 255, 0.01);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.job-empty-state span {
    font-size: 1.25rem;
    display: block;
    margin-bottom: 0.25rem;
}

.job-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.job-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.job-target {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
}

.job-item-body {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.job-item-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-top: 0.25rem;
}

/* Button size modifications */
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* ==================== RESPONSIVE STYLES FOR MOBILE / IPHONE ==================== */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1.25rem;
        padding-bottom: 1.25rem;
    }
    
    .header-logo {
        justify-content: center;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
        padding: 0.7rem 1rem;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    :root {
        --glass-blur: blur(12px);
    }
    
    .app-container {
        padding: 1rem 0.75rem;
        gap: 1.25rem;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
        gap: 1rem;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        border-radius: 10px;
    }
    
    .stat-value {
        font-size: 1.65rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .accounts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .account-card {
        padding: 1.25rem;
        border-radius: 14px;
    }
    
    .card-header {
        margin-bottom: 1rem;
    }
    
    .card-name {
        font-size: 1.05rem;
    }
    
    .card-actions {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .card-actions .btn {
        width: 100%;
    }
    
    /* Modals mobile friendliness */
    .modal-backdrop {
        padding: 0.75rem;
    }
    
    .modal {
        width: 100%;
        max-width: 100%;
        padding: 1.25rem;
        border-radius: 14px;
    }
    
    .modal-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.15rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group input, .form-group textarea {
        padding: 0.65rem;
        font-size: 0.9rem;
    }
    
    .modal-footer-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
        margin-top: 1.25rem;
    }
    
    .modal-footer-actions .btn {
        width: 100%;
    }
    
    /* Login Box mobile friendliness */
    .login-box {
        padding: 1.75rem 1.25rem;
        width: 92%;
        border-radius: 14px;
    }
    
    .login-header {
        margin-bottom: 1.5rem;
    }
    
    .login-header h2 {
        font-size: 1.35rem;
    }
}
