/* Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --brand-color: #3B82F6;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --danger-color: #ef4444;
    --success-color: #22c55e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s;
    background: var(--card-bg);
    color: var(--text-color);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--brand-color);
    color: white;
}

.btn-light {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
}

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

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

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Home Page */
.home-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.home-content h1 {
    font-size: 48px;
    margin-bottom: 10px;
    color: var(--brand-color);
}

.home-content p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Gallery */
.gallery-container {
    min-height: 100vh;
}

.gallery-header {
    padding: 40px 20px;
    text-align: center;
    color: white;
}

.gallery-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.gallery-header p {
    opacity: 0.9;
    margin-bottom: 20px;
}

.gallery-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.photo-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-item:hover {
    transform: scale(1.02);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    padding: 20px 15px;
    cursor: pointer;
    border-radius: 4px;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: calc(85vh - 60px);
    object-fit: contain;
}

.lightbox-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Share Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.share-btn {
    flex: 1;
    padding: 12px;
    text-align: center;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-size: 14px;
}

.share-btn.facebook { background: #1877f2; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.whatsapp { background: #25d366; }

.share-link {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.share-link input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.share-link button {
    padding: 10px 20px;
    background: var(--brand-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* QR Code Page */
.qr-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.qr-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.qr-content h1 {
    margin-bottom: 10px;
}

.qr-code {
    margin: 30px 0;
}

.qr-code svg {
    max-width: 300px;
    height: auto;
}

.qr-url {
    color: var(--text-muted);
    margin-bottom: 20px;
    word-break: break-all;
}

.qr-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

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

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 30px;
    text-align: center;
}

/* Admin */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
    font-size: 36px;
    color: var(--brand-color);
}

.stat-card p {
    color: var(--text-muted);
}

.admin-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.inline-form {
    display: flex;
    gap: 10px;
}

.inline-form input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
}

td a {
    color: var(--brand-color);
    text-decoration: none;
}

td.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
}

td.actions {
    display: flex;
    gap: 8px;
}

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

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-muted {
    background: #f3f4f6;
    color: #6b7280;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
}

.alert code {
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    word-break: break-all;
}

.code-block {
    background: #1f2937;
    color: #e5e7eb;
    padding: 20px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    overflow-x: auto;
}

.code-block p {
    color: #9ca3af;
    margin: 15px 0 5px;
}

.code-block p:first-child {
    margin-top: 0;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
}

.code-block a {
    color: #60a5fa;
}

/* Forms */
.form-container {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

.form-group textarea {
    resize: vertical;
}

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

.color-input input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input {
    width: 20px;
    height: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* Form Footer (login/register links) */
.form-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
}

.form-footer a {
    color: var(--brand-color);
    text-decoration: none;
    font-weight: 500;
}

/* Share URL Input */
.share-url-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background: #f9fafb;
    color: var(--text-color);
}

/* Home Links */
.home-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .gallery-header h1 {
        font-size: 24px;
    }

    .lightbox-nav {
        padding: 15px 10px;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
    }

    .inline-form {
        flex-direction: column;
        width: 100%;
    }

    td.actions {
        flex-direction: column;
    }
}

/* Event Title Row */
.event-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.rename-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rename-form input {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    font-size: 16px;
    background: rgba(255,255,255,0.9);
    color: var(--text-color);
}

/* Photo Checkboxes */
.photo-item {
    position: relative;
}

.photo-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    z-index: 10;
    accent-color: var(--brand-color);
}

.photo-item.selected {
    outline: 3px solid var(--brand-color);
    outline-offset: -3px;
}

.photo-item.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(59, 130, 246, 0.2);
    pointer-events: none;
}

/* Bulk Actions Bar */
.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

#selected-count {
    font-weight: 500;
    color: var(--text-color);
}

/* Toggle Switch */
.toggle-form {
    margin: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    transition: background 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-label input:checked + .toggle-switch {
    background: var(--success-color);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(22px);
}

/* Chart */
.chart-container {
    height: 250px;
    margin-top: 15px;
}
