@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    /* Varion RolePlay Palette */
    --bg-app: #0E1116;
    /* Black Color */
    --bg-panel: #161B22;
    /* Slightly lighter for cards */
    --bg-hover: #21262D;

    --text-main: #F0F9FF;
    /* White Color */
    --text-muted: #8B949E;

    --accent: #4FB6FF;
    /* Main Color (Light Blue) */
    --accent-hover: #3FA0E6;
    --accent-text: #FFFFFF;

    --border: #30363D;
    --border-highlight: #8B949E;

    --danger: #FF453A;

    --radius: 12px;
    --header-height: 64px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #30363D;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484F58;
}

/* ═══ UTILS ═══ */
.hidden {
    display: none !important;
}

.screen {
    display: none;
    height: 100%;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ═══ LOGIN SCREEN ═══ */
.login-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #161B22 0%, #0E1116 100%);
}

.login-card {
    width: 100%;
    max-width: 360px;
    padding: 40px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.login-logo p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.icon-box {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: rgba(79, 182, 255, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.icon-box svg {
    width: 28px;
    height: 28px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    background: #0D1117;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.input-group input::placeholder {
    color: #484F58;
}

.input-group input:focus {
    background: #0D1117;
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 182, 255, 0.15);
}

.btn-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.btn-eye:hover {
    color: var(--text-main);
}

.error-text {
    margin-top: 16px;
    color: var(--danger);
    font-size: 13px;
    min-height: 20px;
}

/* ═══ BUTTONS ═══ */
.btn {
    border: 1px solid transparent;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    padding: 0 20px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(79, 182, 255, 0.25);
}

.btn-secondary {
    background: #21262D;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #30363D;
    border-color: #8B949E;
}

.btn-danger {
    background: rgba(255, 69, 58, 0.1);
    color: var(--danger);
    border: 1px solid transparent;
}

.btn-danger:hover {
    background: rgba(255, 69, 58, 0.2);
    border-color: rgba(255, 69, 58, 0.3);
}

.btn-block {
    width: 100%;
}

/* ═══ HEADER ═══ */
.app-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(22, 27, 34, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark-sm {
    width: 32px;
    height: 32px;
    background: rgba(79, 182, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.logo-text {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.search-bar {
    position: relative;
    width: 420px;
}

.search-bar input {
    width: 100%;
    height: 36px;
    background: #0D1117;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 12px 0 36px;
    color: var(--text-main);
    font-size: 13px;
    transition: all 0.2s;
}

.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 182, 255, 0.15);
}

.search-bar svg {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* ═══ TOOLBAR ═══ */
.toolbar {
    padding: 20px 32px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.toolbar-left {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-muted);
    overflow-x: auto;
    scrollbar-width: none;
}

.breadcrumb::-webkit-scrollbar {
    display: none;
}

.crumb {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}

.crumb:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.crumb.active {
    color: var(--accent);
    background: rgba(79, 182, 255, 0.08);
    cursor: default;
}

.crumb-sep {
    color: var(--text-muted);
    opacity: 0.4;
}

.view-switcher {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: inline-flex;
    padding: 3px;
    flex-shrink: 0;
}

.view-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.view-btn svg {
    width: 16px;
    height: 16px;
}

.view-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.view-btn.active {
    background: var(--bg-hover);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ═══ GRID ═══ */
.file-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 32px;
}

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.file-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.file-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.preview-box {
    background: #0D1117;
    border: 1px solid transparent;
    border-radius: 8px;
    aspect-ratio: 16/10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
    transition: border-color 0.2s;
}

.file-card:hover .preview-box {
    border-color: #30363D;
}

.preview-box svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    opacity: 0.7;
    transition: all 0.2s;
}

.file-card:hover .preview-box svg {
    color: var(--accent);
    opacity: 1;
    transform: scale(1.1);
}

.file-info .name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-info .meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* List View */
.list-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-view .file-card {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    height: 64px;
    background: transparent;
    border-color: transparent;
}

.list-view .file-card:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    transform: none;
}

.list-view .preview-box {
    width: 40px;
    height: 40px;
    margin-bottom: 0;
    aspect-ratio: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
}

.list-view .preview-box svg {
    width: 20px;
    height: 20px;
}

.list-view .file-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-view .name {
    font-size: 14px;
    margin-bottom: 0;
}

.list-view .meta {
    text-align: right;
}

/* ═══ CONTEXT MENU ═══ */
#context-menu {
    background: #161B22;
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 6px;
    z-index: 1000;
    min-width: 180px;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 6px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.1s;
}

.ctx-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.ctx-item:hover {
    background: var(--accent);
    color: #FFFFFF;
}

.ctx-item:hover svg {
    color: #FFFFFF;
}

.ctx-item.delete:hover {
    background: var(--danger);
}

/* ═══ OTHER ═══ */
.upload-status {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: #161B22;
    border: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: #30363D;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.2s linear;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-highlight);
    padding: 40px;
    text-align: center;
    border-radius: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: rgba(22, 27, 34, 0.5);
}

.drop-zone:hover {
    border-color: var(--accent);
    background: rgba(79, 182, 255, 0.05);
}

.drop-zone svg {
    width: 48px;
    height: 48px;
    color: var(--accent);
    margin-bottom: 16px;
}

.drop-zone h3 {
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 500;
}

.drop-zone p {
    color: var(--text-muted);
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(79, 182, 255, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
    color: var(--accent);
}

.empty-state h3 {
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}

.modal {
    width: 100%;
    max-width: 420px;
    background: #161B22;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8);
    animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal h2 {
    margin-bottom: 8px;
    font-size: 20px;
    color: var(--text-main);
    font-weight: 600;
}

.modal .desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Spinner Small */
.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
}

/* Toast */
.toast {
    background: #161B22;
    border: 1px solid #30363D;
    color: #F0F9FF;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile */
@media(max-width: 768px) {
    .search-bar {
        display: none;
    }

    .logo-text {
        display: none;
    }

    .app-header {
        padding: 0 16px;
    }

    .toolbar {
        padding: 16px;
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .toolbar-left,
    .actions {
        width: 100%;
        justify-content: space-between;
    }

    .actions {
        display: flex;
    }

    .file-area {
        padding: 0 16px 16px;
    }

    .grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}