:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #eef2ff;
    --bg: #f6f8fc;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

button, input, select { font: inherit; }

a { text-decoration: none; }

.top-navbar {
    height: 72px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(18px, 5vw, 60px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 21px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 7px 18px rgba(79,70,229,.25);
}

.brand-name {
    font-size: 1.12rem;
    font-weight: 900;
    letter-spacing: -.03em;
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: white;
    font-weight: 800;
}

.profile-info strong {
    display: block;
    font-size: .82rem;
}

.profile-info span {
    display: block;
    font-size: .68rem;
    color: var(--muted);
}

.logout-btn {
    padding: 8px 13px;
    border-radius: 9px;
    background: #fff1f2;
    color: #dc2626;
    font-size: .76rem;
    font-weight: 800;
}

.main-container {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 70px;
}

.section-kicker {
    display: inline-block;
    color: #6366f1;
    font-size: .66rem;
    font-weight: 900;
    letter-spacing: 1.25px;
    margin-bottom: 5px;
}

.welcome-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.welcome-section h1 {
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 900;
    letter-spacing: -.035em;
}

.welcome-section p {
    color: var(--muted);
    font-size: .86rem;
    margin-top: 4px;
}

.cloud-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #bbf7d0;
    font-size: .73rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.flash-container {
    margin-bottom: 20px;
    transition: opacity .35s ease, transform .35s ease;
}

.flash-container.hide {
    opacity: 0;
    transform: translateY(-8px);
}

.flash-message {
    padding: 11px 15px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: .8rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.flash-message.success, .auth-message.success {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.flash-message.danger, .auth-message.danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.flash-message.warning, .auth-message.warning {
    background: #fffbeb;
    color: #a16207;
    border-color: #fde68a;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 17px;
    margin-bottom: 26px;
}

.stat-card {
    min-height: 105px;
    padding: 19px;
    border-radius: 17px;
    color: white;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
}

.stat-card.blue { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.stat-card.purple { background: linear-gradient(135deg,#8b5cf6,#6d28d9); }
.stat-card.orange { background: linear-gradient(135deg,#f97316,#c2410c); }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.2);
    font-size: 21px;
}

.stat-card span {
    display: block;
    font-size: .72rem;
    opacity: .9;
}

.stat-card strong {
    display: block;
    margin-top: 2px;
    font-size: 1.3rem;
}

.upload-section, .files-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 23px;
    box-shadow: var(--shadow);
    margin-bottom: 26px;
}

.upload-header, .files-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.upload-header h2, .files-top h2 {
    font-size: 1.28rem;
    font-weight: 900;
}

.upload-header p, .files-top p {
    color: var(--muted);
    font-size: .78rem;
    margin-top: 4px;
}

.upload-limit, .file-count {
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #c7d2fe;
    font-size: .7rem;
    font-weight: 900;
    white-space: nowrap;
}

.file-type-cards {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 9px;
    margin: 19px 0;
}

.file-type-card {
    padding: 11px 5px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    transition: .2s ease;
}

.file-type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(15,23,42,.08);
}

.type-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 6px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 17px;
}

.image-card .type-icon { background: #eef2ff; }
.pdf-card .type-icon { background: #fee2e2; }
.video-card .type-icon { background: #fef3c7; }
.ppt-card .type-icon { background: #dcfce7; }

.file-type-card strong {
    display: block;
    font-size: .74rem;
}

.file-type-card span {
    display: block;
    color: #94a3b8;
    font-size: .58rem;
    margin-top: 2px;
}

.upload-box {
    min-height: 185px;
    border: 2px dashed #cbd5e1;
    border-radius: 17px;
    background: linear-gradient(135deg,#f8fafc,#f5f3ff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    transition: .2s ease;
}

.upload-box:hover, .upload-box.dragover {
    border-color: #6366f1;
    background: #eef2ff;
}

.upload-cloud-icon {
    width: 55px;
    height: 55px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    background: #e0e7ff;
    font-size: 26px;
    margin-bottom: 9px;
}

.upload-box h3 {
    font-size: .95rem;
    font-weight: 900;
}

.upload-box p {
    color: var(--muted);
    font-size: .74rem;
    margin: 5px 0 12px;
}

.file-input-wrapper input[type="file"] { display: none; }

.file-select-btn {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 9px;
    background: white;
    border: 1px solid var(--border);
    color: #334155;
    font-size: .74rem;
    font-weight: 800;
    cursor: pointer;
}

.file-select-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.file-name-preview {
    min-height: 18px;
    margin-top: 8px;
    color: var(--primary);
    font-size: .72rem;
    font-weight: 800;
}

.file-error { color: #dc2626 !important; }

.upload-action-area {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.upload-button, .filter-btn {
    border: 0;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg,#6366f1,#4f46e5);
    font-weight: 900;
}

.upload-button {
    min-width: 190px;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: .78rem;
    box-shadow: 0 7px 18px rgba(79,70,229,.23);
}

.upload-button:hover { transform: translateY(-1px); }

.upload-button:disabled {
    opacity: .65;
    cursor: wait;
}

.search-bar {
    display: grid;
    grid-template-columns: 1fr 180px 90px;
    gap: 10px;
    margin: 20px 0 15px;
}

.search-input, .search-bar select {
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: white;
    padding: 0 12px;
    color: var(--text);
    outline: none;
    font-size: .76rem;
}

.search-input:focus, .search-bar select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px #eef2ff;
}

.filter-btn {
    border-radius: 9px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.file-row {
    display: grid;
    grid-template-columns: 45px minmax(0,1fr) 170px auto;
    align-items: center;
    gap: 13px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.file-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #f1f5f9;
    font-size: 19px;
}

.file-details {
    min-width: 0;
}

.file-details strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .8rem;
}

.file-details span, .file-date {
    color: var(--muted);
    font-size: .66rem;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.file-actions form { margin: 0; }

.download-btn, .delete-btn {
    display: inline-block;
    padding: 7px 10px;
    border-radius: 8px;
    border: 0;
    font-size: .68rem;
    font-weight: 800;
    cursor: pointer;
}

.download-btn {
    background: #eef2ff;
    color: #4338ca;
}

.delete-btn {
    background: #fef2f2;
    color: #dc2626;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty-state div { font-size: 34px; margin-bottom: 8px; }
.empty-state h3 { color: var(--text); font-size: .95rem; }
.empty-state p { font-size: .75rem; margin-top: 3px; }

/* Authentication */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, #e0e7ff 0, transparent 32%),
        radial-gradient(circle at bottom right, #ede9fe 0, transparent 30%),
        #f8fafc;
    padding: 24px;
}

.auth-container { width: min(430px, 100%); }

.auth-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 32px;
    box-shadow: 0 20px 55px rgba(15,23,42,.11);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 900;
}

.auth-logo {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg,#4f46e5,#7c3aed);
    color: white;
    font-size: 20px;
}

.auth-heading {
    margin: 27px 0 21px;
}

.auth-heading h1 {
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: -.03em;
}

.auth-heading p {
    color: var(--muted);
    font-size: .8rem;
    margin-top: 5px;
}

.auth-messages { margin-bottom: 15px; }

.auth-message {
    padding: 10px 12px;
    border-radius: 9px;
    font-size: .73rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.auth-form { display: flex; flex-direction: column; gap: 15px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: .73rem;
    font-weight: 800;
}

.form-group input {
    width: 100%;
    height: 43px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
    font-size: .78rem;
}

.form-group input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px #eef2ff;
}

.password-wrap { position: relative; }

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

.password-toggle {
    position: absolute;
    right: 8px;
    top: 7px;
    height: 29px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: .68rem;
    font-weight: 800;
    cursor: pointer;
}

.auth-button {
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg,#6366f1,#4f46e5);
    color: white;
    font-size: .8rem;
    font-weight: 900;
    cursor: pointer;
    margin-top: 3px;
}

.auth-button:hover { background: linear-gradient(135deg,#4f46e5,#3730a3); }

.auth-switch {
    text-align: center;
    color: var(--muted);
    font-size: .73rem;
    margin-top: 20px;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 900;
}

@media (max-width: 900px) {
    .file-type-cards { grid-template-columns: repeat(4,1fr); }
    .file-row { grid-template-columns: 45px minmax(0,1fr) auto; }
    .file-date { display: none; }
}

@media (max-width: 650px) {
    .top-navbar { padding: 0 15px; }
    .profile-info { display: none; }
    .main-container { width: min(100% - 24px, 1180px); }
    .welcome-section { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr; }
    .upload-section, .files-section { padding: 17px; }
    .upload-header, .files-top { align-items: flex-start; flex-direction: column; }
    .file-type-cards { grid-template-columns: repeat(2,1fr); }
    .search-bar { grid-template-columns: 1fr; }
    .file-row { grid-template-columns: 40px minmax(0,1fr); }
    .file-actions { grid-column: 2; }
    .auth-card { padding: 24px; }
}

/* ================================
   REGISTER PAGE FIX
   ================================ */

.auth-form {
    width: 100%;
}

.auth-form .form-group {
    width: 100%;
    margin-bottom: 18px;
}

.auth-form .form-group label {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #182033;
}

.auth-form .form-group input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    padding: 0 15px;
    border: 1px solid #d7dbea;
    border-radius: 10px;
    background: #ffffff;
    color: #182033;
    font-size: 15px;
    outline: none;
    transition: 0.2s ease;
}

.auth-form .form-group input::placeholder {
    color: #9aa1b2;
}

.auth-form .form-group input:focus {
    border-color: #6254e8;
    box-shadow: 0 0 0 3px rgba(98, 84, 232, 0.12);
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 70px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #5b4ee8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 5px;
}

.password-toggle:hover {
    color: #4034c7;
}

.auth-form .auth-button {
    width: 100%;
    height: 50px;
    margin-top: 8px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6254e8, #5143df);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.auth-form .auth-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(81, 67, 223, 0.25);
}

/* =========================================================
   CLOUDDROPPER ADMIN DASHBOARD
   ========================================================= */

.admin-page {
    margin: 0;
    min-height: 100vh;
    background: #f5f7fc;
    color: #182033;
    font-family: Arial, sans-serif;
}

.admin-navbar {
    height: 72px;
    padding: 0 5%;
    background: #ffffff;
    border-bottom: 1px solid #e8eaf2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    color: #182033;
}

.admin-cloud-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6254e8, #5143df);
    color: #ffffff;
    font-size: 21px;
}

.admin-nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-badge {
    padding: 8px 13px;
    border-radius: 20px;
    background: #f0edff;
    color: #5143df;
    font-size: 13px;
    font-weight: 700;
}

.admin-logout {
    text-decoration: none;
    color: #555d70;
    font-size: 14px;
    font-weight: 600;
}

.admin-logout:hover {
    color: #5143df;
}

.admin-container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 38px 0 60px;
}

.admin-heading {
    margin-bottom: 28px;
}

.admin-kicker,
.admin-section-kicker {
    display: block;
    margin-bottom: 7px;
    color: #6254e8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
}

.admin-heading h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    color: #182033;
}

.admin-heading p {
    margin: 7px 0 0;
    color: #737b8f;
    font-size: 14px;
}


/* STAT CARDS */

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 30px;
}

.admin-stat-card {
    min-height: 105px;
    padding: 20px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #e9ebf3;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 5px 20px rgba(30, 35, 60, 0.05);
}

.admin-stat-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
}

.users-icon {
    background: #eeeaff;
}

.files-icon {
    background: #e9f4ff;
}

.storage-icon {
    background: #eafaf2;
}

.status-icon {
    background: #e9f9ef;
}

.admin-stat-card span {
    display: block;
    color: #777f91;
    font-size: 13px;
    margin-bottom: 6px;
}

.admin-stat-card strong {
    display: block;
    color: #182033;
    font-size: 22px;
    font-weight: 800;
}


/* SECTIONS */

.admin-section {
    margin-bottom: 28px;
    background: #ffffff;
    border: 1px solid #e9ebf3;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(30, 35, 60, 0.04);
}

.admin-section-header {
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #edf0f5;
}

.admin-section-header h2 {
    margin: 0;
    color: #182033;
    font-size: 20px;
}

.admin-count {
    padding: 7px 12px;
    border-radius: 20px;
    background: #f2f3f8;
    color: #626a7d;
    font-size: 12px;
    font-weight: 700;
}


/* TABLE */

.admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

.admin-table th {
    padding: 14px 24px;
    background: #fafbfe;
    color: #70788b;
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.admin-table td {
    padding: 17px 24px;
    border-top: 1px solid #f0f1f5;
    color: #626a7d;
    font-size: 13px;
}

.admin-table td strong {
    color: #20273a;
    font-weight: 700;
}

.admin-table tbody tr:hover {
    background: #fafaff;
}


/* ROLE BADGES */

.role-badge,
.file-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 800;
}

.admin-role {
    background: #eeeaff;
    color: #5949dc;
}

.user-role {
    background: #edf5ff;
    color: #3975b8;
}

.file-type-badge {
    background: #f2f3f7;
    color: #626a7d;
}


/* EMPTY TABLE */

.empty-table {
    padding: 30px !important;
    text-align: center !important;
    color: #9299a8 !important;
}


/* RESPONSIVE */

@media (max-width: 1000px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .admin-navbar {
        padding: 0 20px;
    }

    .admin-brand {
        font-size: 18px;
    }

    .admin-badge {
        display: none;
    }

    .admin-container {
        width: calc(100% - 30px);
        padding-top: 25px;
    }

    .admin-heading h1 {
        font-size: 26px;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-section-header {
        padding: 18px;
    }

    .admin-table th,
    .admin-table td {
        padding: 13px 16px;
    }
}

/* Admin Delete File Button */
.admin-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-width: 105px;
    height: 38px;
    padding: 0 16px;

    border: none;
    border-radius: 9px;

    background: linear-gradient(135deg, #ff5f6d, #e53935);
    color: #ffffff;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
    transition: all 0.2s ease;

    box-shadow: 0 4px 10px rgba(229, 57, 53, 0.18);
}

.admin-delete-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #ff4757, #d32f2f);
    box-shadow: 0 7px 16px rgba(229, 57, 53, 0.28);
}

.admin-delete-btn:active {
    transform: translateY(0);
}

.admin-table td:last-child {
    text-align: center;
    white-space: nowrap;
}

.admin-table td:last-child form {
    margin: 0;
}


.admin-user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #182033;
}

.admin-file-name {
    font-weight: 600;
    color: #182033;
    white-space: nowrap;
}

.admin-role {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 65px;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.admin-role-admin {
    background: #eeeaff;
    color: #5b4ee8;
}

.admin-role-user {
    background: #e8f8ef;
    color: #16834a;
}

.admin-current-user {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 105px;
    height: 38px;
    padding: 0 12px;
    border-radius: 9px;
    background: #f1f2f6;
    color: #777d8f;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

