/* ============================================
   Pakarti File Manager - Global Styles
   ============================================ */

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

:root {
    --bg: #0f0f17;
    --bg-2: #1a1a2e;
    --bg-3: #242438;
    --border: #2a2a45;
    --text: #e8e8f0;
    --text-dim: #8b8ba7;
    --accent: #667eea;
    --accent-hover: #7c92f5;
    --danger: #e74c3c;
    --success: #27ae60;
    --radius: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

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

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, #1a1a2e 0%, #0f0f17 70%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-logo {
    font-size: 64px;
    text-align: center;
    margin-bottom: 10px;
}

.login-box h1 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 6px;
}

.login-sub {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 24px;
}

.login-footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 20px;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

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

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    transition: border-color 0.2s;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

input[type="file"] {
    padding: 10px;
    cursor: pointer;
}

/* Password toggle */
.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 45px;
}

.eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
}
.eye-btn:hover {
    background: var(--bg);
}

/* ============================================
   CAPTCHA BOX (Math)
   ============================================ */
.captcha-box {
    display: flex;
    align-items: center;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 6px 4px 16px;
    transition: border-color 0.2s;
    min-height: 52px;
    gap: 0;
}

.captcha-box:focus-within {
    border-color: var(--accent);
}

.captcha-question {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-shadow: 0 0 12px rgba(102, 126, 234, 0.4);
    flex-shrink: 0;
    padding-right: 8px;
}

.captcha-eq {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 16px;
    text-shadow: none;
}

.captcha-box input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 10px;
    color: var(--text);
    font-size: 18px;
    font-family: inherit;
    text-align: center;
    letter-spacing: 2px;
    font-weight: 700;
    min-width: 0;
    width: 100%;
}

.captcha-box input[type="text"]:focus {
    outline: none;
    border: none;
}

.captcha-box input[type="text"]::placeholder {
    color: var(--text-dim);
    letter-spacing: normal;
    font-weight: 400;
    font-size: 15px;
    opacity: 0.7;
}

.captcha-refresh {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 18px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.captcha-refresh:hover {
    background: var(--bg);
    color: var(--accent);
    transform: rotate(180deg);
}

.captcha-refresh:active {
    transform: rotate(180deg) scale(0.9);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
    line-height: 1.4;
}

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

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

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #c0392b;
    color: white;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    animation: alertIn 0.3s ease;
}

@keyframes alertIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-error {
    background: rgba(231, 76, 60, 0.15);
    color: #ff6b5b;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.alert-success {
    background: rgba(39, 174, 96, 0.15);
    color: #4cd964;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-wrap: wrap;
    gap: 10px;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}
.logo:hover {
    color: var(--accent);
}

.nav-link {
    color: var(--text-dim);
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
}
.nav-link:hover {
    background: var(--bg-3);
    color: var(--text);
}

/* User menu dropdown */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.user-menu:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.dropdown-content a:last-child {
    border-bottom: none;
}
.dropdown-content a:hover {
    background: var(--bg-3);
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.container-narrow {
    max-width: 560px;
}

.page-title {
    font-size: 22px;
    margin-bottom: 20px;
}

/* ============================================
   PROFILE
   ============================================ */
.profile-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    margin-bottom: 16px;
}

.profile-card h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.profile-role {
    color: var(--accent);
    font-size: 13px;
}

.profile-since {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 24px;
}

.card-form {
    text-align: left;
}

/* ============================================
   STATS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-num {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-top: 4px;
}

.badge {
    background: var(--bg-3);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
}

/* ============================================
   FILE LIST (View Log, Search)
   ============================================ */
.file-list {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    background: var(--bg-3);
    font-weight: 600;
}

.file-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.file-table tr:last-child td {
    border-bottom: none;
}

.file-table tr:hover td {
    background: var(--bg-3);
}

.file-name a {
    color: var(--text);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.file-name a:hover {
    color: var(--accent);
}

.file-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 16px;
    color: var(--text);
}
.icon-btn:hover {
    background: var(--bg-3);
}
.icon-btn.danger:hover {
    background: rgba(231, 76, 60, 0.2);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.empty-sub {
    font-size: 13px;
    margin-top: 6px;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.15s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.modal-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.modal-content input[type="text"] {
    margin-bottom: 16px;
}

.modal-content p {
    color: var(--text);
    margin-bottom: 12px;
    font-size: 14px;
}

.modal-content .text-dim {
    color: var(--text-dim);
    font-size: 13px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ============================================
   VIEW PAGE (preview)
   ============================================ */
.view-page {
    background: #000;
}

.view-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 65px);
    padding: 20px;
}

.view-media {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    border-radius: 8px;
}

.filename {
    color: var(--text-dim);
    font-size: 14px;
}

.share-title {
    text-align: center;
    margin-bottom: 16px;
}

/* ============================================
   SEARCH
   ============================================ */
.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-form input {
    flex: 1;
}

.search-result-info {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 12px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a {
    padding: 6px 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
}

.pagination a.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .topbar {
        padding: 10px 14px;
    }
    .topbar-right {
        gap: 6px;
    }
    .nav-link {
        padding: 6px 8px;
        font-size: 13px;
    }
    .container {
        padding: 14px;
    }
    .hide-mobile {
        display: none;
    }
    .file-table td,
    .file-table th {
        padding: 10px;
    }
    .file-actions {
        gap: 2px;
    }
    .icon-btn {
        padding: 5px 6px;
        font-size: 15px;
    }
    .login-box {
        padding: 30px 20px;
    }
    .stat-num {
        font-size: 22px;
    }
    .captcha-question {
        font-size: 17px;
    }
    .captcha-box input[type="text"] {
        font-size: 16px;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--bg-3);
}
