:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Animations */
@keyframes bloble {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Login specific */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
}

.background-animation {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: bloble 10s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #6366f1;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #ec4899;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-container {
    width: 100%;
    max-width: 400px;
    z-index: 1;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0.5rem;
}

.brand h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand .icon {
    font-size: 2.5rem;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
}

.input-group label {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: 0.3s ease;
    pointer-events: none;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 0.8rem;
    background: var(--bg-dark);
    padding: 0 5px;
    color: var(--primary);
    border-radius: 3px;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-primary.loading .loader {
    display: block;
}

.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.hidden {
    display: none;
}

.hidden-input {
    display: none;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-align: center;
    min-height: 1.25rem;
}

/* Base App Layout */
.app-body {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 10;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

.sidebar-brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-brand .icon {
    font-size: 1.8rem;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.sidebar-bottom {
    margin-top: auto;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem;
    color: var(--danger);
    text-decoration: none;
    border-radius: 12px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
}

.top-header {
    height: 80px;
    padding: 0 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.top-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.content-body {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

.btn-secondary {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.text-danger {
    color: var(--danger) !important;
}

/* Galleries Grid */
.galleries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.gallery-card {
    background: var(--bg-panel);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: 0.3s;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.gallery-body {
    padding: 1.5rem;
    min-height: 100px; /* Placeholder for thumbnails */
}

.gallery-footer {
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.w-full {
    width: 100%;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 15px;
}

.empty-state i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.1);
}

.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
    opacity: 1;
    transition: 0.3s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    width: 100%;
    max-width: 450px;
    background: var(--bg-panel);
    padding: 2rem;
    border-radius: 20px;
    position: relative;
}

.viewer-wrapper {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 1rem;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.viewer-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.viewer-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}
.viewer-nav-btn:hover {
    background: var(--primary);
}
.btn-prev { left: 15px; }
.btn-next { right: 15px; }

.viewer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    color: white;
}

.viewer-overlay .close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    z-index: 1000;
}

.upload-area {
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    margin-bottom: 20px;
}
.upload-area:hover {
    border-color: var(--primary);
}
.upload-area i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}
.upload-preview {
    text-align: center;
    margin-bottom: 20px;
}
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 20px;
}
.progress-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.3s;
}

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

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

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2rem;
}

/* Toasts */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    background: var(--bg-panel);
    color: white;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

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

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
