@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
    --bg-base: #0a0e17;
    --bg-gradient-1: #0d1220;
    --bg-gradient-2: #131a2e;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg-strong: rgba(255, 255, 255, 0.06);

    --accent-blue: #3B9EFF;
    --accent-purple: #7C5CFF;
    --accent-gradient: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));

    --text-primary: #F2F5FA;
    --text-secondary: #9AA6BD;
    --text-muted: #626d84;

    --success: #2ED9A8;
    --error: #FF5C7A;
    --warning: #FFB454;

    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 10px;

    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-deep: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background:
        radial-gradient(circle at 15% 10%, rgba(59, 158, 255, 0.10), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(124, 92, 255, 0.10), transparent 40%),
        linear-gradient(160deg, var(--bg-gradient-1), var(--bg-base) 60%, var(--bg-gradient-2));
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-soft);
}

/* ==================================================================
   Auth Page (Login)
   ================================================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    margin-bottom: 20px;
}

.auth-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

.field-group {
    text-align: right;
    margin-bottom: 22px;
}

.field-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.password-wrapper {
    position: relative;
}

input[type="password"],
input[type="text"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 13px 44px 13px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

input[type="password"]:focus,
input[type="text"]:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.06);
}

.toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--text-primary);
}

.btn-primary {
    width: 100%;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
    box-shadow: 0 8px 24px rgba(59, 158, 255, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(59, 158, 255, 0.35);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary.is-loading .btn-text {
    visibility: hidden;
    position: relative;
}

.btn-primary.is-loading {
    position: relative;
}

.btn-primary.is-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin: -9px 0 0 -9px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13.5px;
    margin-bottom: 20px;
    text-align: right;
    animation: fadeUp 0.3s ease;
}

.alert-error {
    background: rgba(255, 92, 122, 0.12);
    border: 1px solid rgba(255, 92, 122, 0.3);
    color: #FF8FA3;
}

.alert-warning {
    background: rgba(255, 180, 84, 0.12);
    border: 1px solid rgba(255, 180, 84, 0.3);
    color: #FFC97A;
}

.alert-success {
    background: rgba(46, 217, 168, 0.12);
    border: 1px solid rgba(46, 217, 168, 0.3);
    color: #5EEAC4;
}

/* ==================================================================
   Dashboard
   ================================================================== */
.dashboard {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius-lg);
    padding: 18px 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 14px;
}

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

.header-title h1 {
    font-size: 18px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(46, 217, 168, 0.08);
    border: 1px solid rgba(46, 217, 168, 0.25);
    padding: 6px 12px;
    border-radius: 999px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.logout-form {
    display: inline-block;
}

.btn-logout {
    background: rgba(255, 92, 122, 0.1);
    border: 1px solid rgba(255, 92, 122, 0.3);
    color: #FF8FA3;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-logout:hover {
    background: rgba(255, 92, 122, 0.18);
}

.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Upload Section */
.upload-section {
    border-radius: var(--radius-lg);
    padding: 24px;
}

.upload-box {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: 44px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease;
    position: relative;
}

.upload-box:hover,
.upload-box.dragover {
    border-color: var(--accent-blue);
    background: rgba(59, 158, 255, 0.05);
}

.upload-box.dragover {
    transform: scale(1.005);
}

.upload-box-content svg {
    color: var(--accent-blue);
    margin-bottom: 14px;
}

.upload-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.upload-subtitle {
    color: var(--text-secondary);
    font-size: 13.5px;
    margin-bottom: 12px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 12px;
}

.file-selected {
    text-align: right;
}

.file-selected-info {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.file-selected-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.file-selected-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
    flex-grow: 1;
}

.file-selected-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-selected-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-remove-file {
    background: rgba(255, 92, 122, 0.1);
    border: 1px solid rgba(255, 92, 122, 0.25);
    color: #FF8FA3;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.btn-remove-file:hover {
    background: rgba(255, 92, 122, 0.2);
}

.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    animation: fadeUp 0.3s ease;
}

.progress-bar-bg {
    flex-grow: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 999px;
    transition: width 0.2s ease;
}

.progress-percent {
    font-size: 12.5px;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.upload-status {
    margin-top: 16px;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13.5px;
    text-align: right;
    animation: fadeUp 0.3s ease;
}

.btn-upload {
    margin-top: 18px;
}

/* Files List */
.files-section {
    border-radius: var(--radius-lg);
    padding: 24px;
}

.files-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.files-count {
    background: rgba(59, 158, 255, 0.12);
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.files-empty {
    color: var(--text-muted);
    font-size: 13.5px;
    text-align: center;
    padding: 24px 0;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    transition: background 0.2s ease, transform 0.15s ease;
    animation: fadeUp 0.3s ease;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.055);
    transform: translateX(-2px);
}

.file-item-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.file-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
    flex-grow: 1;
}

.file-item-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    direction: ltr;
    text-align: right;
    unicode-bidi: plaintext;
}

/* ==================================================================
   Responsive
   ================================================================== */
@media (max-width: 640px) {
    .auth-card {
        padding: 32px 22px;
    }

    .dashboard-header {
        padding: 16px 18px;
    }

    .header-title h1 {
        font-size: 16px;
    }

    .upload-box {
        padding: 32px 14px;
    }

    .files-section,
    .upload-section {
        padding: 18px;
    }
}

@media (max-width: 420px) {
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
}
