* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow-x: hidden;
}

header {
    background-color: #333;
    color: white;
    padding: 1rem;
    text-align: center;
}

nav ul {
    list-style: none;
    padding: 1rem 0;
}

nav ul li {
    display: inline;
    margin: 0 1rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
}

.moodboard-section {
    padding: 0.5rem;
    margin: 0;
    display: none;
}

.moodboard-section h2,
.moodboard-section h3 {
    display: none;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.grid-container figure {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    height: 250px;
}

.grid-container figure.landscape {
    width: 100%;
}

.grid-container figure.portrait {
    width: 75%;
    margin: 0 auto;
}

.grid-container img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    background-color: #eee;
}

.grid-container figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.grid-container figure:hover figcaption {
    transform: translateY(0);
}

.grid-container figure:hover img {
    transform: scale(1.33);
}

footer {
    text-align: center;
    padding: 1rem;
    background-color: #333;
    color: white;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .grid-container figure {
        height: 200px;
    }
}

.tag-container,
.tag-filters,
.tag-button {
    display: none;
}

.category-filters {
    padding: 0;
    background: transparent;
    color: white;
    font-size: 0.9rem;
}

.category-filters ul {
    list-style: none;
    margin-left: 1.2rem;
}

.category-filters > ul {
    margin-left: 0;
}

.category-filters li {
    margin: 0.15rem 0;
}

.category-button {
    padding: 0.15rem 0.5rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    font-size: inherit;
}

.category-button:hover {
    background: #555;
}

.category-button.active {
    background: #4CAF50;
}

.category-button.empty {
    opacity: 0.5;
    color: #ccc;
    cursor: default;
}

.category-button.empty:hover {
    background: transparent;
}

.category-button[data-category*="_"] {
    margin-left: 0;
}

.content-wrapper {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 300px;
    background: #444;
    color: white;
    padding: 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar h1 a {
    color: inherit;
    text-decoration: none;
}

.sidebar h1 a:hover {
    color: #4CAF50;
    text-decoration: underline;
}

#moodboard-container {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 300px;
    }
}

.modal {
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal-content {
    max-width: 80%;
    max-height: 80%;
    display: block;
    margin: 0 auto;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.caption {
    color: #ccc;
    margin-top: 1rem;
    text-align: center;
    max-width: 80%;
    font-size: 1rem;
    line-height: 1.4;
    display: block;
    padding: 0.5rem 1rem;
    text-align: left;
}

.breadcrumbs {
    padding: 0.5rem 1rem;
    background: #444;
    color: #fff;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.breadcrumbs .path {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
}

.breadcrumbs span {
    opacity: 0.7;
}

.breadcrumbs strong {
    opacity: 1;
    font-weight: normal;
    color: #4CAF50;
}

.breadcrumbs span + span::before {
    content: "›";
    margin: 0 0.5rem;
    opacity: 0.5;
}

.breadcrumbs a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumbs a:hover {
    color: #4CAF50;
}

.missing-image {
    background: #ddd;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.missing-image::after {
    content: '⚠️ Imagem indisponível';
    position: absolute;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.category-tags {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 2;
}

.grid-container figure:hover .category-tags {
    transform: translateY(0);
}

.category-tag {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.grid-container figure:hover figcaption,
.grid-container figure:hover .category-tags {
    transform: translateY(0);
}

.shuffle-toggle {
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    text-align: left;
}

.shuffle-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.shuffle-toggle.active {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.button-group {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.category-button {
    flex-grow: 1;
}

.solo-button {
    padding: 0.15rem 0.4rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
    title: "Adicionar à seleção";
}

.solo-button:hover {
    background: #555;
    color: white;
}

.category-button ~ .solo-button:hover {
    background: #555;
}

.category-button:has(+ .solo-button:hover) {
    background: #555;
}

.housekeeping-button {
    width: 100%;
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.housekeeping-button:hover {
    background: #45a049;
}

.category-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem;
    z-index: 3;
    display: none;
}

.category-editor input.category-input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: #444;
    color: white;
    border: 1px solid #666;
    border-radius: 3px;
}

.category-editor textarea {
    width: 100%;
    min-height: 80px;
    margin-bottom: 0.5rem;
    background: #333;
    color: #aaa;
    border: 1px solid #555;
    padding: 0.5rem;
    font-family: monospace;
}

.category-editor button {
    padding: 0.25rem 0.5rem;
    margin-right: 0.5rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.housekeeping-mode .grid-container figure {
    cursor: pointer;
}

.housekeeping-mode .grid-container figure::after {
    content: '✎';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.25rem;
    border-radius: 3px;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.housekeeping-mode .grid-container figure:hover::after {
    opacity: 1;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    z-index: 1;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
