:root {
    --cream-deep: #F5E6D3;
    --cream-warm: #FAF0E6;
    --cream-soft: #FFF8F0;
    --cream-pure: #FFFCF8;
    --latte: #D4A574;
    --latte-dark: #8B6F47;
    --latte-light: #E8C9A0;
    --text-dark: #3D2B1F;
    --text-mid: #6B5344;
    --text-light: #9C8B7A;
    --shadow-soft: rgba(61, 43, 31, 0.06);
    --danger: #C75B5B;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--cream-pure);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--latte-light), var(--cream-deep));
    opacity: 0.06;
    animation: float 25s infinite ease-in-out;
}

.floating-shape:nth-child(1) {
    width: 500px;
    height: 500px;
    top: -150px;
    left: -100px;
    animation-delay: 0s;
}

.floating-shape:nth-child(2) {
    width: 350px;
    height: 350px;
    bottom: -80px;
    right: -80px;
    animation-delay: -8s;
}

.floating-shape:nth-child(3) {
    width: 250px;
    height: 250px;
    top: 40%;
    left: 55%;
    animation-delay: -15s;
    opacity: 0.04;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -30px) scale(1.05); }
    66% { transform: translate(-15px, 15px) scale(0.95); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--latte-dark);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-mid);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.glass {
    background: rgba(255, 252, 248, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 24px;
    box-shadow: 0 4px 24px var(--shadow-soft);
}

.auth-card {
    max-width: 420px;
    margin: 0 auto 2rem;
    padding: 2.5rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(212, 165, 116, 0.08);
    border-radius: 16px;
    padding: 5px;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-mid);
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--latte), var(--latte-light));
    color: white;
    box-shadow: 0 2px 12px rgba(212, 165, 116, 0.3);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 1rem 1.25rem;
    border: 1.5px solid rgba(212, 165, 116, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    transition: all 0.3s ease;
    color: var(--text-dark);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--latte);
    box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.1);
    background: white;
}

.auth-form input::placeholder {
    color: var(--text-light);
}

.btn-primary {
    padding: 1rem;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--latte), var(--latte-light));
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(212, 165, 116, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 165, 116, 0.35);
}

.btn-secondary {
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--latte);
    border-radius: 12px;
    background: transparent;
    color: var(--latte-dark);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--latte);
    color: white;
}

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease-out;
}

#user-greeting {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--latte-dark);
}

.upload-area {
    padding: 3.5rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
    border: 2px dashed rgba(212, 165, 116, 0.25);
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.03), rgba(245, 230, 211, 0.03));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover::before, .upload-area.dragover::before {
    opacity: 1;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--latte);
    border-style: solid;
    transform: translateY(-1px);
    box-shadow: 0 8px 32px rgba(212, 165, 116, 0.12);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.upload-content p {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.upload-content .sub {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 400;
}

.upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 252, 248, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.progress-bar {
    width: 180px;
    height: 4px;
    background: rgba(212, 165, 116, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, var(--latte), var(--latte-light));
    animation: progress 2s infinite ease-in-out;
    border-radius: 2px;
}

@keyframes progress {
    0% { left: -40%; }
    100% { left: 100%; }
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.gallery-header h2 {
    font-size: 1.4rem;
    color: var(--text-dark);
    font-weight: 600;
}

.btn-refresh {
    padding: 0.5rem 1rem;
    border: none;
    background: rgba(212, 165, 116, 0.1);
    color: var(--latte-dark);
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: var(--latte);
    color: white;
    transform: rotate(180deg);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    animation: fadeInUp 0.6s ease-out;
}

.file-card {
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.file-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(61, 43, 31, 0.08);
    border-color: rgba(212, 165, 116, 0.3);
}

.file-preview {
    height: 180px;
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.04), rgba(245, 230, 211, 0.04));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.file-card:hover .file-preview img {
    transform: scale(1.03);
}

.file-icon {
    font-size: 3.5rem;
    opacity: 0.5;
}

.file-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.file-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.uploader {
    color: var(--latte-dark);
    font-weight: 500;
}

.size {
    color: var(--text-light);
    background: rgba(212, 165, 116, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.file-date {
    font-size: 0.78rem;
    color: var(--text-light);
    opacity: 0.7;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 10px;
    background: rgba(212, 165, 116, 0.1);
    color: var(--latte-dark);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-small:hover {
    background: var(--latte);
    color: white;
}

.btn-danger {
    background: rgba(199, 91, 91, 0.08);
    color: var(--danger);
}

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

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    font-size: 1.1rem;
    color: var(--text-light);
    background: rgba(255, 252, 248, 0.8);
    border-radius: 24px;
    border: 2px dashed rgba(212, 165, 116, 0.15);
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--text-dark);
    color: white;
    border-radius: 16px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--danger);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 43, 31, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 2rem;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    padding: 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.preview-name {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--text-dark);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@media (max-width: 600px) {
    header h1 { font-size: 2.2rem; }
    .gallery { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
}