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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f0eb 0%, #ede8e3 100%);
    min-height: 100vh;
    padding: 0;
    color: #333;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { font-size: 32px; }

.logo-text {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #555, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-img {
    height: 50px;
    width: auto;
}

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

.user-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, #555 0%, #333 100%);
    border-radius: 20%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-name {
    color: #3d3d3d;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    padding: 10px 18px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.user-name:hover {
    background: white;
    color: #3d3d3d;
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.user-name:active { transform: translateY(0); }

.user-name::after {
    content: ' ✏️';
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    margin-left: 8px;
}

.user-name:hover::after { opacity: 1; }

.add-gallery-btn {
    color: #3d3d3d;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    padding: 10px 18px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.add-gallery-btn:hover {
    color: #3d3d3d;
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    background: white;
    transform: translateY(-2px);
}

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

.logout-btn {
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.logout-btn:hover { background: #c0392b; }

/* ========================================
   CONTAINER & WELCOME
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.welcome {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.welcome h1 {
    font-size: 32px;
    margin-bottom: 10px;
    color: #3d3d3d;
}

.welcome p {
    font-size: 16px;
    opacity: 0.9;
    color: #555;
}

/* ========================================
   LOADING & ERROR STATES
   ======================================== */

.loading {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #555;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

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

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 16px;
    opacity: 0.8;
}

.error-state {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.error-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.refresh-btn {
    background: rgba(0, 0, 0, 0.1);
    color: #3d3d3d;
    border: 2px solid rgba(0, 0, 0, 0.2);
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

#refreshIcon {
    display: inline-block;
    transition: transform 0.6s;
}

.refresh-btn:hover #refreshIcon { transform: rotate(180deg); }

.refresh-btn.loading #refreshIcon {
    animation: spin 1s linear infinite;
}

/* ========================================
   GALLERY GRID & CARDS
   ======================================== */

.galleries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.gallery-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.gallery-image {
    width: 100%;
    height: 520px;
    object-fit: cover;
    display: block;
}

.gallery-placeholder {
    width: 100%;
    height: 520px;
    background: linear-gradient(135deg, #e8e4f3 0%, #d9d4e7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.gallery-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 10s linear infinite;
}

.placeholder-icon {
    font-size: 64px;
    opacity: 0.8;
    z-index: 1;
    animation: pulse 2s ease-in-out infinite;
}

.gallery-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 20px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
    color: white;
}

.gallery-title {
    font-size: 20px;
    font-weight: bold;
    color: white;
    margin-bottom: 4px;
}

.gallery-date {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 10px;
}

.gallery-stats {
    display: flex;
    gap: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.stat-value {
    font-weight: 600;
    color: white;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
}

.badge-new      { background: #e74c3c; color: white; }
.badge-completed { background: #27ae60; color: white; }

/* ========================================
   MODAL
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s;
}

.modal-box {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.modal-close {
    font-size: 32px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
    transform: rotate(90deg);
}

.modal-body { padding: 25px; }

.modal-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.modal-input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-footer {
    padding: 25px;
    border-top: none;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.02));
}

.modal-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.modal-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.modal-btn:active::before {
    width: 300px;
    height: 300px;
}

.modal-btn.cancel {
    background: white;
    color: #7f8c8d;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.modal-btn.cancel:hover {
    background: #f8f9fa;
    border-color: #bdc3c7;
    color: #5a6c7d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-btn.cancel:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.modal-btn.primary {
    background: linear-gradient(135deg, #555 0%, #333 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: white;
    border: none;
}

.modal-btn.primary:hover {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    transform: translateY(-3px);
}

.modal-btn.primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

.modal-btn.primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.modal-btn-icon {
    margin-right: 6px;
    font-size: 18px;
    vertical-align: middle;
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */

.toast-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    background: white;
    padding: 40px 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    animation: toastIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    text-align: center;
    max-width: 90%;
}

.toast-notification.hide {
    animation: toastOut 0.3s ease-in forwards;
}

.toast-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: checkmark 0.6s ease-in-out;
}

.toast-message {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.toast-submessage {
    font-size: 14px;
    color: #999;
}

.toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.toast-overlay.hide {
    animation: fadeOut 0.3s forwards;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1);   opacity: 0.8; }
    50%       { transform: scale(1.1); opacity: 1; }
}

@keyframes toastIn {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes toastOut {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

@keyframes checkmark {
    0%   { transform: scale(0);   opacity: 0; }
    50%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 12px;
    }

    .logo      { gap: 8px; }
    .logo-icon { font-size: 28px; }
    .logo-text { font-size: 22px; }
    .logo-img  { height: 35px; }

    .user-info { justify-content: center !important; }

    .user-avatar {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 20px;
        border: 2px solid white;
    }

    .user-name {
        font-size: 14px;
        padding: 6px 10px;
        max-width: 120px;
    }

    .user-name::after { font-size: 12px; }

    .add-gallery-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .welcome h1 { font-size: 24px; }

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

    .modal-footer {
        flex-direction: column;
        gap: 10px;
        padding: 20px;
    }

    .modal-btn {
        width: 100%;
        padding: 16px 32px;
        font-size: 17px;
    }
}

@media (max-width: 380px) {
    .user-name {
        max-width: 90px;
        font-size: 13px;
        padding: 5px 8px;
    }

    .add-gallery-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .logo-text { font-size: 20px; }
}