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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f4f4f4;
    color: #1a1a1a;
    min-height: 100vh;
}

/* Header */
header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

header nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    font-size: 0.875rem;
    color: #666;
}

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.event-meta {
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.event-desc {
    color: #444;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

/* Events grid */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.event-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.15s, transform 0.15s;
    display: block;
}

.event-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.event-card img,
.event-card-placeholder {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    background: #e8e8e8;
}

.event-card-info {
    padding: 1rem;
}

.event-card-info h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Photos grid */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.photo-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.photo-item img {
    width: 100%;
    height: 230px;
    object-fit: cover;
    display: block;
    transition: opacity 0.15s;
}

.photo-thumb {
    cursor: pointer;
}

.photo-thumb:hover {
    opacity: 0.88;
}

.photo-footer {
    padding: 0.35rem 0.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Upload */
.upload-section {
    margin-bottom: 2rem;
}

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

#lightbox.active {
    display: flex;
}

#lb-img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    display: block;
    border-radius: 2px;
    user-select: none;
}

.lb-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 10%;
    min-width: 3rem;
    background: none;
    border: none;
    color: white;
    font-size: 4rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.07);
}

#lb-prev { left: 0; }
#lb-next { right: 0; }

#lb-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    z-index: 1;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
}

#lb-close:hover { opacity: 1; background: none; }

#lb-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    pointer-events: none;
}

/* Auth form */
.auth-form {
    max-width: 380px;
    margin: 5rem auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-form h1 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

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

.auth-form p {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #666;
}

.auth-form a {
    color: #1a1a1a;
}

/* Empty states */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.empty-photos {
    grid-column: 1 / -1;
    color: #888;
    padding: 2rem 0;
}

/* Inputs */
input[type="text"],
input[type="password"],
input[type="date"],
textarea {
    padding: 0.55rem 0.75rem;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    background: white;
    transition: border-color 0.15s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #999;
}

textarea {
    resize: vertical;
}

/* Buttons */
button,
.btn {
    padding: 0.55rem 1.1rem;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    transition: background 0.15s;
}

button:hover,
.btn:hover {
    background: #333;
}

.btn-secondary {
    padding: 0.55rem 1.1rem;
    background: white;
    color: #1a1a1a;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.15s;
}

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

.btn-danger {
    background: white;
    color: #c00;
    border: 1px solid #f0c0c0;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background 0.15s;
}

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

.btn-link {
    background: none;
    color: #666;
    border: 1px solid #e0e0e0;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
}

.btn-link:hover {
    background: #f4f4f4;
    color: #1a1a1a;
}

.btn-delete {
    background: none;
    color: #bbb;
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

.btn-delete:hover {
    color: #c00;
    background: none;
}

/* File input */
.file-label input[type="file"] {
    display: none;
}

.file-label span {
    padding: 0.55rem 1.1rem;
    background: white;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    display: inline-block;
}

.file-label span:hover {
    background: #f4f4f4;
}

/* Select mode */
.select-indicator {
    display: none;
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: white;
    border: 2px solid #ccc;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: transparent;
    z-index: 2;
    pointer-events: none;
}

.select-mode .photo-item {
    cursor: pointer;
}

.select-mode .select-indicator {
    display: flex;
}

.select-mode .photo-footer {
    display: none;
}

.select-mode .photo-item:hover {
    outline: 2px solid #aaa;
}

.photo-item.selected {
    outline: 3px solid #1a1a1a;
}

.photo-item.selected .select-indicator {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: white;
}

.photo-item {
    position: relative;
}

/* Upload overlay */
#upload-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

#upload-overlay.active {
    display: flex;
}

#upload-progress-box {
    background: white;
    border-radius: 10px;
    padding: 2rem 2.5rem;
    min-width: 300px;
    text-align: center;
}

#upload-status {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 1rem;
}

#upload-progress-bar-bg {
    background: #e8e8e8;
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

#upload-progress-bar {
    height: 100%;
    width: 0%;
    background: #1a1a1a;
    border-radius: 99px;
    transition: width 0.15s;
}

#upload-percent {
    font-size: 0.8rem;
    color: #888;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.page-info {
    font-size: 0.875rem;
    color: #666;
    min-width: 4rem;
    text-align: center;
}

.btn-secondary.disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
}

/* Responsive */
@media (max-width: 600px) {
    main {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
    }

    .upload-form {
        flex-direction: column;
        align-items: stretch;
    }
}
