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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 768px) {
    .nav-content {
        padding: 0.75rem 1rem;
    }
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
}

@media (max-width: 768px) {
    .logo {
        font-size: 1.2rem;
    }
}

.nav-links a {
    margin-left: 2rem;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

@media (max-width: 768px) {
    .nav-links a {
        margin-left: 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-links a {
        margin-left: 0;
    }
}

.nav-links a:hover {
    color: #667eea;
}

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

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    min-width: 350px;
}

.login-box h1 {
    margin-bottom: 2rem;
    color: #667eea;
}

.login-box input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.error {
    background: #fee;
    color: #c33;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.success {
    background: #efe;
    color: #3a3;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

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

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

button[type="submit"]:hover {
    background: #5568d3;
}

/* Dashboard */
.dashboard {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .dashboard {
        padding: 1rem;
        border-radius: 8px;
    }
}

.dashboard h1 {
    margin-bottom: 2rem;
    color: #333;
}

@media (max-width: 768px) {
    .dashboard h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
}

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

@media (max-width: 768px) {
    .galleries-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.gallery-card {
    background: #f9f9f9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gallery-preview {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .gallery-preview {
        height: 180px;
    }
}

.gallery-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .gallery-count {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

.gallery-actions {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gallery-actions .btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-width: 0;
}

.gallery-actions form {
    flex: 1;
}

.gallery-actions form button {
    width: 100%;
}

@media (max-width: 768px) {
    .gallery-actions {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .gallery-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        padding: 0.5rem 0.5rem;
        font-size: 0.85rem;
    }

    .gallery-actions form {
        flex: 1 1 calc(50% - 0.25rem);
    }
}

@media (max-width: 480px) {
    .gallery-actions .btn,
    .gallery-actions form {
        flex: 1 1 100%;
    }
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-state p {
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

/* Upload Page */
.upload-page {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.upload-page h1 {
    margin-bottom: 2rem;
    color: #333;
}

.file-input-wrapper {
    margin-bottom: 2rem;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-label {
    display: block;
    padding: 2rem;
    background: #f9f9f9;
    border: 3px dashed #667eea;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-label:hover {
    background: #f0f0ff;
    border-color: #5568d3;
}

.file-label span {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
}

.file-count {
    margin-top: 0.5rem;
    font-size: 1rem !important;
    color: #666 !important;
    font-weight: normal !important;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.preview-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.progress-container {
    margin-top: 2rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Settings Page */
.settings-page {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.settings-page h1 {
    margin-bottom: 2rem;
    color: #333;
}

.settings-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .settings-container {
        grid-template-columns: 1fr;
    }
}

.settings-panel, .preview-panel {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 12px;
}

.settings-panel h2, .preview-panel h2 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.3rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.slider {
    width: calc(100% - 60px);
    margin-right: 10px;
}

#intensityValue {
    display: inline-block;
    width: 40px;
    text-align: center;
    font-weight: 600;
    color: #667eea;
}

.preview-image-container {
    width: 100%;
    aspect-ratio: 4/3;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.preview-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-help {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.share-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
}

.share-section h3 {
    margin-bottom: 1rem;
    color: #333;
}

.share-link-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.share-link-box input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: monospace;
}

.back-link {
    margin-top: 2rem;
}

.back-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Change Password Page */
.change-password-page {
    max-width: 600px;
    margin: 2rem auto;
}

.change-password-box {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .change-password-page {
        margin: 1rem auto;
    }

    .change-password-box {
        padding: 1.5rem;
    }
}

.change-password-box h1 {
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

.change-password-box .form-group {
    margin-bottom: 1.5rem;
}

.change-password-box .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.change-password-box .form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.change-password-box .form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.change-password-box .form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

.change-password-box .back-link {
    margin-top: 1.5rem;
    text-align: center;
}

/* Shared Gallery Page */
.shared-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.shared-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

@media (max-width: 768px) {
    .shared-container {
        padding: 1rem;
    }
}

.shared-container h1 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

@media (max-width: 768px) {
    .shared-container h1 {
        font-size: 1.8rem;
    }
}

.gallery-info {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .gallery-info {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

.reveal-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .reveal-section {
        padding: 1rem;
    }
}

.mosaic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .mosaic-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .mosaic-grid {
        grid-template-columns: 1fr;
    }
}

.mosaic-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .mosaic-image img {
        height: 150px;
    }
}

.reveal-btn {
    max-width: 400px;
    margin: 0 auto;
}

.full-gallery {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .full-gallery {
        padding: 1rem;
    }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.gallery-image {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gallery-image img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s, opacity 0.3s;
    opacity: 0;
}

.gallery-image img[src] {
    opacity: 1;
}

.gallery-image:hover img {
    transform: scale(1.02);
}

.loading-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: white;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    text-align: center;
}

.gallery-image:hover .image-overlay {
    opacity: 1;
}

@media (max-width: 768px) {
    .image-overlay {
        opacity: 1;
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.lightbox-content {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s;
}

.lightbox-loading {
    position: absolute;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: #ccc;
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
}
