/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

header h1 {
    color: #2d3436;
    font-size: 1.8rem;
}

header h1 i {
    color: #667eea;
    margin-right: 10px;
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: #636e72;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

nav a:hover, nav a.active {
    background: #667eea;
    color: white;
}

.admin-link {
    background: #ff7675;
    color: white !important;
}

.admin-link:hover {
    background: #d63031;
}

/* Gallery */
main {
    padding: 40px 0;
    background: rgba(255, 255, 255, 0.95);
    margin: 20px auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    min-height: calc(100vh - 200px);
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Gallery Grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    background: white;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.gallery-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gallery-info {
    padding: 15px;
}

.gallery-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: #2d3436;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-info p {
    font-size: 0.85rem;
    color: #636e72;
    margin-bottom: 8px;
    line-height: 1.4;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.image-category {
    display: inline-block;
    padding: 3px 10px;
    background: #dfe6e9;
    border-radius: 15px;
    font-size: 0.75rem;
    color: #636e72;
}

.image-date {
    font-size: 0.75rem;
    color: #b2bec3;
    margin-top: 5px;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: #636e72;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1001;
    padding: 20px;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-lightbox:hover {
    color: #ff7675;
}

.lightbox-img {
    max-width: 80%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 10px;
}

.lightbox-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
}

.lightbox-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.lightbox-info p {
    color: #dfe6e9;
    margin-bottom: 10px;
}

.image-date i {
    margin-right: 5px;
}

/* Footer */
footer {
    background: #2d3436;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* ===== ADMIN STYLES ===== */

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    color: #667eea;
    margin-bottom: 15px;
}

.login-header h1 {
    color: #2d3436;
    margin-bottom: 10px;
}

.login-header p {
    color: #636e72;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #2d3436;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: #667eea;
    outline: none;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #636e72;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    background: #5a67d8;
}

.login-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #636e72;
}

.login-info i {
    color: #667eea;
    margin-right: 5px;
}

.back-link {
    text-align: center;
    margin-top: 20px;
}

.back-link a {
    color: #667eea;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-footer {
    text-align: center;
    color: white;
    margin-top: 20px;
}

/* Admin Page */
.admin-page {
    background: #f8f9fa;
    min-height: 100vh;
}

.admin-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.btn:hover {
    background: #5a67d8;
}

.btn-logout {
    background: #ff7675;
}

.btn-logout:hover {
    background: #d63031;
}

.admin-container {
    display: flex;
    min-height: calc(100vh - 70px);
}

.admin-sidebar {
    width: 250px;
    background: #2d3436;
    color: white;
    padding: 20px 0;
}

.admin-info {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid #4a5568;
}

.admin-avatar {
    margin-bottom: 10px;
}

.admin-avatar i {
    color: #667eea;
}

.admin-menu {
    padding: 20px 0;
}

.admin-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #cbd5e0;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.admin-menu a:hover,
.admin-menu a.active {
    background: #4a5568;
    color: white;
    border-left-color: #667eea;
}

.admin-main {
    flex: 1;
    padding: 30px;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #ddd;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    transition: border-color 0.3s;
    cursor: pointer;
}

.upload-area.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area i {
    color: #667eea;
    margin-bottom: 15px;
}

.btn-browse {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px 0;
    transition: background 0.3s;
}

.btn-browse:hover {
    background: #5a67d8;
}

.upload-info {
    color: #718096;
    font-size: 0.9rem;
    margin-top: 10px;
}

#fileInput {
    display: none;
}

.preview-area {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.preview-item {
    width: 120px;
    position: relative;
}

.preview-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
}

.remove-preview {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff7675;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-upload {
    padding: 12px 30px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.3s;
}

.btn-upload:hover {
    background: #38a169;
}

.upload-progress {
    margin-top: 20px;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #48bb78;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    margin-top: 5px;
    color: #718096;
}

/* Images Grid */
.filter-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.filter-controls input,
.filter-controls select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    flex: 1;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.admin-image-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.admin-image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.admin-image-info {
    padding: 15px;
}

.admin-image-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-edit, .btn-delete {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-edit {
    background: #4299e1;
    color: white;
}

.btn-delete {
    background: #f56565;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1002;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel, .btn-ok {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    flex: 1;
}

.btn-cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-ok {
    background: #f56565;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
    }
    
    .admin-menu {
        display: flex;
        overflow-x: auto;
    }
    
    .admin-menu a {
        white-space: nowrap;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.gallery-item {
    animation: fadeIn 0.5s ease-out;
}