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

body {
    background-color: #e8e8e8;
    color: #222;
    font-family: 'Courier New', Courier, monospace;
    min-height: 100vh;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e8e8e8;
    z-index: 1000;
}

.loading-text {
    font-size: 14px;
    color: #666;
}

/* Main Container */
.main-container {
    display: flex;
    height: 100vh;
}

/* Calendar Panel */
.calendar-panel {
    flex: 1;
    min-width: 300px;
    border-right: 1px solid #bbb;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ccc;
    gap: 10px;
}

.year-nav {
    background: none;
    border: 1px solid #ccc;
    padding: 5px 12px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    color: #555;
}

.year-nav:hover {
    border-color: #4a90d9;
    color: #4a90d9;
}

.year-display {
    font-size: 18px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

.upload-btn {
    margin-left: auto;
    background: #333;
    color: #fff;
    border: none;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.upload-btn:hover {
    background: #4a90d9;
}

.calendar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
}

/* Month */
.month-container {
    margin-bottom: 25px;
}

.month-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    padding-left: 5px;
}

.weekday-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 5px;
}

.weekday {
    text-align: center;
    font-size: 11px;
    color: #888;
    padding: 3px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #555;
    position: relative;
    background: #f0f0f0;
    border: 2px solid transparent;
}

.calendar-cell.empty {
    background: transparent;
}

.calendar-cell.has-photo {
    cursor: pointer;
    background-size: cover;
    background-position: center;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8), -1px -1px 2px rgba(0,0,0,0.8);
}

.calendar-cell.today {
    border-color: #4a90d9;
}

.calendar-cell.selected {
    border-color: #333;
}

.calendar-cell.month-best {
    border-color: #d4af37;
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

.calendar-cell.has-photo:hover {
    opacity: 0.9;
}

/* Preview Panel */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    overflow: hidden;
}

.preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
}

.preview-empty-icon pre {
    font-size: 14px;
    line-height: 1.2;
    color: #aaa;
    margin-bottom: 15px;
}

.preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px 20px;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

#previewImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.leader-crown {
    position: absolute;
    top: 30px;
    left: 30px;
    font-size: 32px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.leader-crown::before {
    content: '\1F451';
}

.preview-info {
    padding: 20px;
    border-top: 1px solid #ccc;
    background: #fafafa;
}

.preview-date {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.preview-description {
    color: #555;
    margin-bottom: 12px;
    font-size: 14px;
}

.preview-stats {
    margin-bottom: 12px;
}

.total-stars {
    font-size: 14px;
    color: #666;
}

.vote-section {
    margin-bottom: 15px;
    padding: 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
}

.your-vote {
    margin-bottom: 8px;
    font-size: 13px;
}

.your-vote .stars {
    color: #d4af37;
    font-size: 18px;
    letter-spacing: 2px;
}

.vote-buttons {
    display: flex;
    gap: 8px;
}

.vote-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ccc;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.vote-btn:hover {
    border-color: #4a90d9;
    color: #4a90d9;
}

.vote-btn.active {
    background: #4a90d9;
    color: #fff;
    border-color: #4a90d9;
}

.preview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 16px;
    border: 1px solid #ccc;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.action-btn:hover {
    border-color: #4a90d9;
    color: #4a90d9;
}

.action-btn.danger {
    color: #c44;
    border-color: #c44;
}

.action-btn.danger:hover {
    background: #c44;
    color: #fff;
}

.expand-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.expand-btn {
    background: none;
    border: none;
    color: #4a90d9;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
}

.expand-btn:hover {
    color: #333;
}

/* Expanded View */
.expanded-view {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.collapse-btn {
    background: none;
    border: none;
    color: #4a90d9;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 15px;
}

.collapse-btn:hover {
    color: #333;
}

.expanded-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.expanded-card {
    width: 280px;
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px;
}

.expanded-card.is-leader {
    border-color: #d4af37;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.expanded-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    margin-bottom: 10px;
    cursor: pointer;
}

.expanded-card-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.expanded-card-leader {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #d4af37;
    font-size: 12px;
    margin-bottom: 8px;
}

.expanded-card-votes {
    margin-bottom: 8px;
    font-size: 13px;
}

.expanded-card-vote-section {
    margin-bottom: 10px;
}

.expanded-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.expanded-card-actions .action-btn {
    font-size: 11px;
    padding: 5px 10px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal {
    background: #fafafa;
    border: 1px solid #bbb;
    padding: 30px 40px;
    max-width: 450px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    background: none;
    border: none;
}

.modal-close:hover {
    color: #333;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="date"] {
    width: 100%;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #ccc;
    background: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: #4a90d9;
}

.file-drop-zone {
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    position: relative;
    background: #fff;
}

.file-drop-zone.dragover {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.file-drop-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-drop-text {
    color: #888;
    font-size: 13px;
}

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

.file-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

.file-preview span {
    font-size: 12px;
    color: #555;
    word-break: break-all;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #333;
    color: #fff;
}

.btn-primary:hover {
    background: #4a90d9;
}

.btn-primary:disabled {
    background: #999;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
}

.btn-secondary:hover {
    border-color: #888;
}

.btn-danger {
    background: #c44;
    color: #fff;
}

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

.btn-danger:disabled {
    background: #999;
    cursor: not-allowed;
}

.upload-error {
    color: #c44;
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

/* Delete Modal */
.delete-modal {
    max-width: 350px;
}

.delete-preview {
    text-align: center;
    margin-bottom: 15px;
}

.delete-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    margin-bottom: 10px;
}

.delete-info {
    font-size: 13px;
    color: #555;
}

/* Access Denied */
.access-denied {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e8e8e8;
}

.access-denied-box {
    text-align: center;
    padding: 40px;
    background: #fafafa;
    border: 1px solid #bbb;
}

.access-denied-box .mascot {
    font-size: 14px;
    line-height: 1.2;
    color: #c44;
    margin-bottom: 20px;
}

.access-denied-box h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.access-denied-box p {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.access-denied-box .footer {
    margin-top: 20px;
}

.access-denied-box .footer a {
    color: #777;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 800px) {
    .main-container {
        flex-direction: column;
    }

    .calendar-panel {
        width: 100%;
        min-width: unset;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid #bbb;
    }

    .calendar-header {
        flex-wrap: wrap;
    }

    .upload-btn {
        width: 100%;
        margin-top: 10px;
        margin-left: 0;
    }

    .preview-panel {
        height: 50vh;
    }
}
