/* assets/css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 0 0 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.logo h1 a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
}

.logo i {
    margin-right: 10px;
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.3s;
}

.nav a:hover {
    background: rgba(255,255,255,0.2);
}

.user-menu {
    position: relative;
    cursor: pointer;
    padding: 8px 16px;
}

.user-menu:hover .dropdown {
    display: block;
}

.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    color: #333;
    min-width: 150px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 100;
}

.dropdown a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
}

.dropdown a:hover {
    background: #f0f0f0;
}

/* Main */
.main {
    padding: 30px 0;
    min-height: calc(100vh - 200px);
}

/* Alert */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.close-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
}

/* Search Bar */
.search-bar {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

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

.search-bar input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.search-bar button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.btn-icon {
    padding: 8px 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon.active {
    background: #667eea;
    color: white;
}

.sort-bar select, .category-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-left: 10px;
}

.stats {
    margin-left: auto;
    color: #666;
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.image-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.image-grid.list-view .image-card {
    display: flex;
    flex-direction: row;
    height: 150px;
}

.image-grid.list-view .image-wrapper {
    width: 200px;
    height: 150px;
}

.image-grid.list-view .image-info {
    flex: 1;
}

.image-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.image-wrapper {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 1;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-card:hover .image-wrapper img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.image-wrapper:hover .image-overlay {
    opacity: 1;
}

.btn-view, .btn-delete {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s;
}

.btn-view {
    background: white;
    color: #667eea;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-view:hover, .btn-delete:hover {
    transform: scale(1.1);
}

.image-info {
    padding: 15px;
}

.image-info h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

.image-meta i {
    margin-right: 4px;
}

.image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: #666;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.empty-state i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.empty-state p {
    color: #999;
    margin-bottom: 20px;
}

/* Pagination */
.pagination-wrapper {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 5px;
    list-style: none;
}

.pagination li a, .pagination li span {
    display: block;
    padding: 8px 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #667eea;
}

.pagination li.active a {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

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

.login-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.login-header h2 {
    margin-bottom: 5px;
    color: #333;
}

.login-header p {
    color: #888;
}

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

.login-form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
}

.login-form label i {
    margin-right: 8px;
    width: 20px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: #5a67d8;
}

.login-info {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #999;
}

/* Upload Area */
.upload-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 16px;
    padding: 60px 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-icon i {
    font-size: 64px;
    color: #667eea;
}

.upload-area h3 {
    margin: 15px 0 10px;
}

.upload-area p {
    color: #999;
    margin-bottom: 20px;
}

.upload-form {
    text-align: left;
    margin-top: 30px;
}

.preview-image {
    text-align: center;
    margin: 20px 0;
}

.preview-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.upload-progress .progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
}

.upload-progress .progress-fill {
    width: 0%;
    height: 100%;
    background: #667eea;
    transition: width 0.3s;
}

.upload-result .result-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.result-icon.success {
    color: #28a745;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5a67d8;
}

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

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* View Page */
.view-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.image-viewer {
    position: relative;
    background: #000;
    text-align: center;
    padding: 20px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer img {
    max-width: 100%;
    max-height: 70vh;
    transition: transform 0.3s;
}

.viewer-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.viewer-controls button, .viewer-controls a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.3s;
}

.viewer-controls button:hover, .viewer-controls a:hover {
    background: rgba(255,255,255,0.4);
}

.image-details {
    padding: 30px;
}

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

.like-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.like-btn:hover {
    background: #f0f0f0;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.info-table {
    width: 100%;
}

.info-table th {
    text-align: left;
    width: 120px;
    padding: 8px 0;
    color: #666;
    font-weight: normal;
}

.related-images {
    padding: 0 30px 30px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.related-card {
    text-decoration: none;
    color: #333;
}

.related-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
}

.related-card span {
    display: block;
    font-size: 12px;
    margin-top: 5px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Edit Page */
.edit-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.edit-form-wrapper, .edit-preview {
    background: white;
    border-radius: 16px;
    padding: 25px;
}

.edit-preview img {
    width: 100%;
    border-radius: 8px;
    margin: 15px 0;
}

.file-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    word-break: break-all;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #888;
    border-top: 1px solid #eee;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats {
        margin-left: 0;
        text-align: center;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .edit-container {
        grid-template-columns: 1fr;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}