/* CSS Base - webOS NSL v1 */

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

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
}

body {
    background: #0a0a0a;
    color: #ffffff;
}

/* Variáveis CSS */
:root {
    /* Cores principais */
    --primary-color: #007acc;
    --secondary-color: #1e1e1e;
    --accent-color: #0078d4;
    --success-color: #107c10;
    --warning-color: #ffb900;
    --error-color: #d13438;

    /* Backgrounds */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --window-bg: #0e1726;
    --bg-window: var(--window-bg, #111827);
    --bg-window-content: #060818;
    --bg-taskbar: rgba(20, 20, 20, 0.9);

    /* Textos */
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;

    /* Bordas */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 8px;
    --border-radius-small: 4px;

    /* Sombras */
    --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* Transições */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-index */
    --z-desktop: 0;
    --z-window: 100;
    --z-taskbar: 900;
    --z-start-menu: 950;
    --z-modal: 1000;
    --z-tooltip: 1100;
}

/* Utilitários */
.flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.hidden { display: none !important; }
.visible { display: block !important; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.m-0 { margin: 0; }
.m-1 { margin: 8px; }
.m-2 { margin: 16px; }
.mt-1 { margin-top: 8px; }
.mb-1 { margin-bottom: 8px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }

/* Botões */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-small);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #106ebe;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #404040;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #a4262c;
}

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

.btn-success:hover:not(:disabled) {
    background: #0e6e0e;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 16px;
}

/* Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkboxes e Radio buttons */
.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-window);
    border-radius: var(--border-radius);
    padding: 24px;
    min-width: 320px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: var(--shadow-large);
    border: 1px solid var(--border-color);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-window);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-medium);
    padding: 4px 0;
    min-width: 160px;
    z-index: var(--z-tooltip);
    display: none;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 13px;
}

.context-menu-item:hover {
    background: var(--bg-tertiary);
}

.context-menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #505050;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 50% 42%, rgba(108, 19, 142, 0.24), transparent 16%),
        radial-gradient(circle at 48% 44%, rgba(0, 78, 255, 0.14), transparent 24%),
        linear-gradient(180deg, rgba(2, 4, 12, 0.98), rgba(4, 7, 20, 0.985));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.loading-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.18;
    mask-image: radial-gradient(circle at center, black 24%, transparent 76%);
}

.loading-shell {
    width: min(520px, calc(100vw - 48px));
    display: grid;
    justify-items: center;
    gap: 20px;
    color: #eef2f7;
    text-align: center;
    position: relative;
    z-index: 1;
}

.loading-core {
    position: relative;
    width: 188px;
    height: 188px;
    display: grid;
    place-items: center;
}

.loading-core::before {
    content: "";
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 18, 32, 0.96) 0%, rgba(4, 6, 15, 0.98) 72%);
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.03),
        0 0 80px rgba(117, 36, 178, 0.18);
}

.loading-orbit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.08);
}

.loading-orbit::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border-top: 2px solid rgba(55, 153, 255, 0.85);
    border-right: 2px solid rgba(255, 93, 61, 0.65);
    border-bottom: 2px solid transparent;
    border-left: 2px solid transparent;
}

.loading-orbit-outer::before {
    animation: loading-spin 2.8s linear infinite;
}

.loading-orbit-inner {
    inset: 18px;
    border-color: rgba(255,255,255,0.06);
}

.loading-orbit-inner::before {
    border-top-color: rgba(173, 95, 255, 0.8);
    border-right-color: rgba(55, 153, 255, 0.55);
    animation: loading-spin-reverse 2s linear infinite;
}

.loading-center {
    position: relative;
    z-index: 1;
    width: 84px;
    height: 84px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(20, 26, 42, 0.88), rgba(8, 11, 22, 0.96));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 18px 32px rgba(0,0,0,0.3);
}

.loading-center i {
    font-size: 30px;
    color: #eef3ff;
    text-shadow: 0 0 18px rgba(86, 150, 255, 0.35);
}

.loading-scanline {
    position: absolute;
    width: 156px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), rgba(85, 172, 255, 0.95), rgba(255,255,255,0.14), transparent);
    box-shadow: 0 0 18px rgba(86, 150, 255, 0.45);
    animation: loading-scan 2.2s ease-in-out infinite;
}

.loading-copy {
    display: grid;
    gap: 10px;
    width: min(420px, 100%);
}

.loading-kicker {
    justify-self: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #99a8c6;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.loading-copy h2 {
    margin: 0;
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.loading-copy p {
    margin: 0;
    color: #94a0b8;
    font-size: 14px;
    line-height: 1.5;
}

.loading-progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.04);
    overflow: hidden;
    position: relative;
}

.loading-progress-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(76, 140, 255, 0.25), rgba(76, 140, 255, 0.95), rgba(255, 94, 61, 0.88));
    box-shadow: 0 0 24px rgba(76, 140, 255, 0.28);
    animation: loading-progress 1.8s ease-in-out infinite;
}

.loading-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #c6d0e4;
    font-size: 13px;
}

.loading-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #63a6ff;
    box-shadow: 0 0 0 0 rgba(99, 166, 255, 0.5);
    animation: loading-pulse 1.4s ease-out infinite;
}

@keyframes loading-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes loading-spin-reverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes loading-scan {
    0%, 100% { transform: translateY(-54px); opacity: 0.6; }
    50% { transform: translateY(54px); opacity: 1; }
}

@keyframes loading-progress {
    0% { left: -22%; width: 24%; }
    50% { left: 32%; width: 36%; }
    100% { left: 100%; width: 24%; }
}

@keyframes loading-pulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 166, 255, 0.45); opacity: 1; }
    70% { box-shadow: 0 0 0 12px rgba(99, 166, 255, 0); opacity: 0.85; }
    100% { box-shadow: 0 0 0 0 rgba(99, 166, 255, 0); opacity: 0.7; }
}

@media (max-width: 640px) {
    .loading-shell {
        width: min(420px, calc(100vw - 32px));
        gap: 16px;
    }

    .loading-core {
        width: 152px;
        height: 152px;
    }

    .loading-center {
        width: 72px;
        height: 72px;
        border-radius: 20px;
    }

    .loading-copy p {
        font-size: 13px;
    }
}

/* Mensagens */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-medium);
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

.message-info {
    background: var(--primary-color);
    color: white;
}

.message-success {
    background: var(--success-color);
    color: white;
}

.message-warning {
    background: var(--warning-color);
    color: white;
}

.message-error {
    background: var(--error-color);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        font-size: 13px;
    }

    .modal-content {
        margin: 20px;
        min-width: auto;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}
