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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

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

.login-container h1 {
    margin-bottom: 30px;
    font-size: 2.5em;
}

#loginForm {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

#loginForm input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

#loginForm button {
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

#loginForm button:hover {
    background: #0056b3;
}

.error {
    color: #dc3545;
    margin-top: 10px;
    font-size: 14px;
}

/* Header */
.header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 1.8em;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.admin-btn {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.admin-btn:hover {
    background: #5a6268;
}

#logoutBtn, #backBtn, #adminBackBtn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#logoutBtn:hover, #backBtn:hover, #adminBackBtn:hover {
    background: #c82333;
}

#backBtn, #adminBackBtn {
    background: #6c757d;
}

#backBtn:hover, #adminBackBtn:hover {
    background: #5a6268;
}

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

/* Buttons */
.btn-primary {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #218838;
}

.btn-secondary {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.btn-icon:hover {
    opacity: 0.7;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.project-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.project-card h3 {
    margin-bottom: 10px;
    color: #007bff;
}

.project-card p {
    color: #666;
    font-size: 14px;
}

.project-card .date {
    color: #999;
    font-size: 12px;
    margin-top: 10px;
}

/* Editor Layout */
.editor-layout {
    display: flex;
    height: calc(100vh - 80px);
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.2em;
}

#addCategoryBtn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #28a745;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

#addCategoryBtn:hover {
    background: #218838;
}

.categories-list {
    padding: 10px;
}

.category-item {
    padding: 15px;
    margin-bottom: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.category-item:hover {
    background: #f8f9fa;
}

.category-item.active {
    background: #007bff;
    color: white;
}

.category-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 1.2em;
}

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

.category-header h2 {
    display: inline-block;
    margin-right: 10px;
}

.upload-btn {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-btn:hover {
    background: #0056b3;
}

/* Category Settings */
.category-settings {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.category-settings h3 {
    margin-bottom: 15px;
}

.category-settings label {
    display: block;
    margin-bottom: 15px;
    font-weight: 500;
}

.category-settings input,
.category-settings select {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.category-settings input[type="color"] {
    height: 40px;
    padding: 2px;
}

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

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.photo-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.photo-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.photo-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.photo-card-actions button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 16px;
}

.photo-card-actions button:hover {
    background: white;
}

/* Admin Panel */
.admin-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-section h2 {
    margin-bottom: 20px;
}

.users-list {
    margin-top: 20px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

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

.admin-badge {
    padding: 3px 8px;
    background: #ffc107;
    color: #333;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.delete-user-btn {
    padding: 6px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.delete-user-btn:hover {
    background: #c82333;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

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

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

.modal-content label {
    display: block;
    margin-bottom: 15px;
    font-weight: 500;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.modal-content textarea {
    resize: vertical;
}

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

/* Utility */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* Cover Photo Section */
.project-cover-section {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.cover-photo-upload {
    max-width: 1200px;
    margin: 0 auto;
}

.cover-preview, .title-preview {
    margin-top: 15px;
    text-align: center;
}

.cover-preview img, .title-preview img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Category Title Photo Section */
.category-title-photo-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.btn-danger {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

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

/* Drag and drop for photos */
.photo-card[draggable="true"] {
    cursor: move;
}

.photo-card.dragging {
    opacity: 0.5;
}

.photo-card .drag-handle {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 8px;
    border-radius: 4px;
    cursor: move;
    font-size: 16px;
    color: #666;
    z-index: 10;
}
