:root {
    --primary: #0a0e27;
    --secondary: #1a1f3a;
    --accent: #00f5d4;
    --accent-dim: #00d4ba;
    --error: #ff006e;
    --success: #00f5a0;
    --text: #e8f1f5;
    --text-dim: #a0b8c2;
    --border: #2a3550;
}

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

[hidden] {
    display: none !important;
}

body {
    font-family: 'Space Mono', monospace;
    background: var(--primary);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(0, 245, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 245, 160, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 0, 110, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--border);
}

.logo {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--accent), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.username {
    color: var(--accent);
    font-weight: 700;
}

/* Auth Forms */
.auth-container {
    max-width: 450px;
    margin: 100px auto;
    background: var(--secondary);
    padding: 50px;
    border-radius: 20px;
    border: 2px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 245, 212, 0.1);
}

.auth-inline {
    margin: 50px auto;
}

.auth-title {
    font-family: 'Syne', sans-serif;
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--accent);
}

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

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.1);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

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

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--success));
    color: var(--primary);
    margin-bottom: 15px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 245, 212, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 5px 15px rgba(0, 245, 212, 0.2);
}

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

.btn-secondary:hover {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:active {
    background: var(--secondary);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #d90060;
}

.btn-danger:active {
    background: #c00056;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

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

.switch-auth a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

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

.small-note {
    margin-top: 20px;
    font-size: 12px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    padding: 15px;
    background: var(--secondary);
    border-radius: 10px;
    border: 2px solid var(--border);
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.3s ease;
    background: none;
    border: none;
    font: inherit;
}

.breadcrumb-item:hover {
    color: var(--accent);
}

.breadcrumb-item.active {
    color: var(--accent);
    font-weight: 700;
    cursor: default;
}

.breadcrumb-separator {
    color: var(--border);
}

/* Controls */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.controls .btn {
    margin-bottom: 0;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.item-card {
    background: var(--secondary);
    border: 2px solid var(--border);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.item-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 245, 212, 0.15);
}

.item-card:hover::before {
    transform: scaleX(1);
}

.item-card.broken {
    border-color: var(--error);
}

.item-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.folder-icon {
    color: var(--accent);
}

.file-icon {
    color: var(--success);
}

.item-name {
    font-weight: 700;
    margin-bottom: 8px;
    word-break: break-word;
    font-size: 14px;
}

.item-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 15px;
    white-space: pre-line;
}

.item-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.item-actions .btn {
    flex: 1;
}

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

.empty-state-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* Messages */
.message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 2px solid;
    animation: slideIn 0.3s ease;
}

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

.message-error {
    background: rgba(255, 0, 110, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.message-success {
    background: rgba(0, 245, 160, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.message-info {
    background: rgba(0, 245, 212, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Encryption Status */
.encryption-status {
    background: rgba(0, 245, 212, 0.1);
    border: 2px solid var(--accent);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 30px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.encryption-icon {
    font-size: 24px;
}

.usage-text {
    display: block;
    margin-top: 6px;
    color: var(--text-dim);
}

/* Progress Bar */
.progress-container {
    background: var(--secondary);
    border: 2px solid var(--border);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 700;
    word-break: break-word;
}

.progress-bar-bg {
    background: var(--primary);
    border-radius: 10px;
    height: 30px;
    overflow: hidden;
    border: 2px solid var(--border);
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-status {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--secondary);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

.modal-wide {
    max-width: 640px;
}

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

.modal-title {
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--accent);
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.modal-actions .btn {
    flex: 1;
    margin-bottom: 0;
}

/* Invites */
.invite-new {
    background: rgba(0, 245, 160, 0.1);
    border: 2px solid var(--success);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.invite-code-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.invite-code-row code {
    font-size: 16px;
    color: var(--success);
    word-break: break-all;
}

.invites-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
}

.invite-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 10px;
}

.invite-row .status-open    { color: var(--accent); }
.invite-row .status-used    { color: var(--text-dim); }
.invite-row .status-expired { color: var(--error); }

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .auth-container {
        padding: 30px 20px;
        margin: 50px auto;
    }

    .controls {
        grid-template-columns: 1fr;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }

    .logo {
        font-size: 24px;
    }
}
