/* ================================
   NastępnaChmurka - Design System
   ================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-muted: #606080;

    --accent-1: #667eea;
    --accent-2: #764ba2;
    --accent-gradient: linear-gradient(135deg, #667eea, #764ba2);
    --accent-glow: rgba(102, 126, 234, 0.3);

    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50%;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(102, 126, 234, 0.05) 0%, transparent 50%);
}

/* --- Glass Card --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--border-hover);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.25rem;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--error);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.25);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-full {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* --- Auth Section --- */
#auth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.7s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-big {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.brand-title {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.brand-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-form {
    padding: 2rem;
}

.auth-form h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--accent-1);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* --- Top Navigation --- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(10, 10, 26, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo {
    font-size: 1.5rem;
}

.nav-brand {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- Dashboard Main --- */
.dashboard-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- Stats Bar --- */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Upload Section --- */
.upload-section {
    margin-bottom: 2rem;
    padding: 0;
    overflow: hidden;
}

.upload-dropzone {
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px dashed transparent;
    border-radius: var(--radius-lg);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    background: rgba(102, 126, 234, 0.08);
    border-color: var(--accent-1);
}

.upload-dropzone.drag-over {
    background: rgba(102, 126, 234, 0.12);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    animation: float 3s ease-in-out infinite;
}

.upload-dropzone h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.upload-dropzone p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.upload-progress {
    padding: 1rem 2rem 1.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

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

/* --- Files Section --- */
.files-section {
    padding: 1.5rem;
}

.files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.files-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- File Item --- */
.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: var(--transition);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}

.file-icon {
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.file-uploader {
    color: var(--accent-1);
    font-weight: 500;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Shared badge */
.shared-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    color: var(--accent-1);
    background: rgba(102, 126, 234, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    margin-left: 0.5rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

.empty-hint {
    font-size: 0.85rem !important;
    margin-top: 0.5rem;
}

/* --- Modal --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    max-width: 480px;
    width: 100%;
    padding: 2rem;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.2rem;
}

.modal-close {
    padding: 0.3rem 0.6rem !important;
    font-size: 1.1rem;
}

.share-filename {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    word-break: break-all;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
}

.share-link-container input {
    flex: 1;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.25rem;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastIn 0.4s ease;
    box-shadow: var(--shadow-md);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.info {
    border-left: 3px solid var(--accent-1);
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Language Switcher --- */
.lang-switcher-auth {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.lang-switcher {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    background: rgba(20, 20, 45, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
    z-index: 200;
    overflow: hidden;
}

.lang-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.lang-option:hover {
    background: rgba(102, 126, 234, 0.12);
    color: var(--text-primary);
}

.lang-option+.lang-option {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Admin Panel --- */
.admin-panel {
    margin-top: 2rem;
    animation: slideUp 0.4s ease;
}

.admin-section {
    padding: 1.5rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.admin-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.admin-stat {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.admin-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-stat-pending {
    color: var(--warning);
}

.admin-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.admin-user-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}

.admin-user-item.pending {
    border-left: 3px solid var(--warning);
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.admin-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.admin-avatar {
    background: var(--accent-gradient);
    border: none;
    color: white;
}

.admin-user-details {
    min-width: 0;
}

.admin-user-name {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-user-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

.pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

.approved-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    color: var(--success);
    background: rgba(74, 222, 128, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

.admin-user-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* --- Preview Modal --- */
.preview-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    min-width: 400px;
    display: flex;
    flex-direction: column;
}

.preview-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 75vh;
}

.preview-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.preview-video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
}

.preview-pdf {
    width: 100%;
    min-width: 600px;
    height: 70vh;
    border: none;
    border-radius: var(--radius-sm);
}

.preview-text {
    width: 100%;
    max-height: 70vh;
    overflow: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.preview-audio-container {
    text-align: center;
    padding: 2rem;
}

.preview-audio-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.preview-audio-name {
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.preview-audio {
    width: 100%;
    max-width: 400px;
}

.preview-unsupported {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.preview-unsupported-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.preview-unsupported-mime {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-family: monospace;
}

.preview-loading {
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .stats-bar {
        grid-template-columns: 1fr;
    }

    .top-nav {
        padding: 0.75rem 1rem;
    }

    .nav-brand {
        display: none;
    }

    .dashboard-main {
        padding: 1rem;
    }

    .file-item {
        flex-wrap: wrap;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }

    .user-name {
        display: none;
    }

    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-user-item {
        flex-wrap: wrap;
    }

    .admin-user-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 1.5rem;
    }

    .brand-title {
        font-size: 1.5rem;
    }

    .upload-dropzone {
        padding: 2rem 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}