/* style.css */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 900px;
    background-color: #ffffff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

header h1 {
    margin: 0;
    font-size: 24px;
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 15px;
}
.form-group:last-child {
    margin-bottom: 0;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
input[type="file"] {
    padding: 5px;
}
.card {
    background-color: #fdfdfd;
    border: 1px solid #e7e7e7;
    border-radius: 6px;
    padding: 5px;
    margin-bottom: 20px;
}

/* --- Filter Bar --- */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}
.filter-form .form-group {
    flex: 1 1 auto;
    margin-bottom: 0;
}
.filter-form button, .filter-form a {
    flex-shrink: 0;
}


/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 12px 18px;
    border: none;
    border-radius: 4px;
    color: #fff;
    background-color: #3498db;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}
.btn:hover { background-color: #2980b9; }
.btn-profile {
    background-color: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
}
.btn-logout { background-color: #e74c3c; }
.btn-logout:hover { background-color: #c0392b; }
.btn-edit { background-color: #f39c12; }
.btn-edit:hover { background-color: #e67e22; }
.btn-delete { background-color: #95a5a6; }
.btn-delete:hover { background-color: #7f8c8d; }
.btn-copy { padding: 8px 12px; font-size: 12px; background-color: #2ecc71; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-copy:hover { background-color: #27ae60; }
.btn-replace { background-color: #1abc9c; }
.btn-replace:hover { background-color: #16a085; }

/* --- Profile Dropdown --- */
.profile-dropdown {
    position: relative;
    display: inline-block;
}
.profile-menu {
    display: none;
    position: absolute;
    right: 0;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    overflow: hidden;
}
.profile-menu.active {
    display: block;
}
.profile-menu a.profile-menu-item, .profile-menu button.profile-menu-item {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}
.profile-menu-item:hover {
    background-color: #f1f1f1;
}


/* --- Messages --- */
.message { padding: 15px; margin-bottom: 20px; border-radius: 4px; text-align: center; }
.message.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.message.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* --- Image Gallery --- */
.image-gallery { display: grid; grid-template-columns: 1fr; gap: 20px; }
.image-card { display: flex; flex-direction: column; }
.image-card a { display: block; }
.image-card img { width: 100%; max-height: 250px; object-fit: cover; border-radius: 4px; margin-bottom: 5px; background-color: #eee; }
.image-info { flex-grow: 1; display: flex; flex-direction: column; }
.info-header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.category-tag, .dimensions-tag {
    background-color: #ecf0f1;
    color: #34495e;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin: 0;
}
.url-copy-container { display: flex; align-items: center; margin-bottom: 8px; }
.url-copy-container input { flex-grow: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; background-color: #ecf0f1; border-color: #bdc3c7; font-size: 12px; }

/* --- Image Actions & Edit Form --- */
.image-actions {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.btn-toggle-more {
    width: 100%;
    background-color: #ecf0f1;
    color: #34495e;
}
.btn-toggle-more:hover {
    background-color: #bdc3c7;
}
.btn-toggle-more .text-close { display: none; }
.btn-toggle-more.active .text-close { display: inline; }
.btn-toggle-more.active .text-open { display: none; }

.collapsible-content, .collapsible-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}
.collapsible-content.active, .collapsible-section.active {
    max-height: 1000px; /* Large value to ensure content fits */
}

.collapsible-content .edit-form, .collapsible-content .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.form-group-inline {
    display: flex;
    flex-direction: column;
}
.form-group-inline label {
    font-size: 12px;
    margin-bottom: 3px;
    color: #555;
}
.edit-form input, .edit-form select {
    padding: 8px;
    font-size: 13px;
}
.action-buttons {
    flex-direction: row;
}
.action-buttons .btn, .action-buttons button, .action-buttons label {
    flex-grow: 1;
    text-align: center;
}
.hidden-file-input { display: none; }


/* --- Pagination --- */
.pagination { margin-top: 30px; padding-top: 20px; border-top: 1px solid #e0e0e0; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.pagination .btn { background-color: #ecf0f1; color: #34495e; }
.pagination .btn:hover { background-color: #bdc3c7; }
.pagination .btn.active { background-color: #3498db; color: #fff; cursor: default; }

/* --- Responsive Design --- */
@media (min-width: 768px) {
    .image-gallery { grid-template-columns: repeat(2, 1fr); }
}
