* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
}

.admin-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* HEADER - Barra superior do painel */
.admin-header {
    background: #1a3a52;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #0d1f2d;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 60px;
    width: auto;
}

.header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.admin-header p {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: white;
    color: #667eea;
}

/* CONTENT AREA */
.admin-content {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 200px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 20px 0;
}

.admin-nav {
    display: flex;
    flex-direction: column;
}

.nav-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    text-align: left;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-btn:hover {
    background: #f5f5f5;
    color: #667eea;
}

.nav-btn.active {
    background: #f0f3ff;
    color: #667eea;
    border-left-color: #667eea;
}

.main-content {
    flex: 1;
    padding: 30px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tab-content h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 22px;
}

/* FORMS */
.category-form,
.image-form {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.images-controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.images-controls .form-group {
    flex: 1;
    margin-bottom: 0;
}

.images-controls .btn {
    white-space: nowrap;
}

/* DRAG AND DROP */
.drag-drop-area {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background: #f8f9fa;
    transition: all 0.3s ease;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-drop-area:hover {
    background: #ecf0f1;
    border-color: #2980b9;
}

.drag-drop-area.drag-over {
    background: #e8f4f8;
    border-color: #2980b9;
    transform: scale(1.02);
}

.drag-drop-content p {
    margin: 5px 0;
    color: #555;
}

.drag-drop-content p:first-child {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
}

.drag-drop-hint {
    font-size: 12px;
    color: #999 !important;
}

.file-preview-container {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.file-preview-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.file-preview-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.file-preview-image {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #f0f0f0;
}

.file-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-order {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #3498db;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.file-info {
    padding: 10px;
    background: white;
}

.file-info p {
    margin: 3px 0;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-name {
    font-weight: 500;
}

/* BUTTONS */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-edit:hover {
    background: #2980b9;
}

.btn-toggle {
    background: #2ecc71;
    color: white;
}

.btn-toggle:hover {
    background: #27ae60;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* TABLES */
.categories-list,
.images-list {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.categories-list h3,
.images-list h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: #f5f7fa;
    border-bottom: 2px solid #e0e0e0;
}

.table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    text-transform: uppercase;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background: #fafafa;
}

.table .actions {
    display: flex;
    gap: 8px;
}

.status {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status.active {
    background: #d4edda;
    color: #155724;
}

.status.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* IMAGES GRID */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.images-grid.single-category {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    align-content: flex-start;
}

.images-grid.single-category .image-item {
    width: calc(50% - 10px);
    min-width: 280px;
}

.image-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.image-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.image-item-info {
    padding: 10px;
}

.image-item-info p {
    font-size: 12px;
    color: #666;
    margin: 4px 0;
}

.image-item-actions {
    padding: 10px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 8px;
}

/* CATEGORY IMAGES SECTION */
.category-images-section {
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.category-images-section h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* MODAL - Lightbox para visualização de imagem */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    margin-top: 5%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from {transform: scale(0.9); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

#modalCaption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 16px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 1001;
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Imagem clicável no grid */
.image-item {
    cursor: pointer;
}

.image-item:hover img {
    opacity: 0.8;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .admin-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        display: flex;
    }

    .admin-nav {
        flex-direction: row;
        flex: 1;
    }

    .nav-btn {
        flex: 1;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-btn.active {
        border-bottom-color: #667eea;
    }

    .main-content {
        padding: 15px;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px;
    }

    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
