/* Reset e Variáveis */
:root {
    --primary-color: #e74c3c;
    --secondary-color: #34495e;
    --text-color: #2c3e50;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --border-color: #dee2e6;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-600: #6c757d;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

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

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-brand i {
    font-size: 1.8rem;
}

.nav-actions {
    display: flex;
    gap: 10px;
}

.nav-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--primary-color);
    background: var(--white);
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

.nav-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

/* Menu Header */
.menu-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 3rem 0;
    text-align: center;
    margin-bottom: 2rem;
}

.menu-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.menu-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Search Section */
.search-section {
    margin: 2rem 0;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.search-box i {
    color: var(--gray-600);
    margin-right: 10px;
    font-size: 1.2rem;
}

.search-box input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

.admin-search {
    margin: 1.5rem 0;
}

/* Filter Section */
.filter-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border-color);
    background: var(--white);
    color: var(--text-color);
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--gray-200);
}

.product-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--gray-600);
}

.product-content {
    padding: 1.5rem;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.product-code {
    background: var(--gray-200);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
}

.product-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.product-description {
    color: var(--gray-600);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.product-unavailable {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--danger-color);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.product-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Admin Section */
.admin-header {
    text-align: center;
    margin: 2rem 0 3rem;
}

.admin-header h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.admin-header p {
    color: var(--gray-600);
    font-size: 1.1rem;
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Card */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.card h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    margin-bottom: 0;
}

/* Form */
.form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.color-input-group {
    display: flex;
    gap: 10px;
}

.color-input-group input[type="color"] {
    width: 60px;
    height: 45px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-input-group input[type="text"] {
    flex: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 0;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-300);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: var(--gray-600);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #229954;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

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

/* Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--gray-100);
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-color);
}

.data-table tr:hover {
    background: var(--gray-100);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    border-radius: 4px;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--gray-200);
}

.icon-btn.edit {
    color: var(--warning-color);
}

.icon-btn.delete {
    color: var(--danger-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-600);
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--gray-200);
    color: var(--text-color);
}

.modal-content .form {
    padding: 1.5rem;
    max-width: 100%;
}

/* FAB Button */
.fab-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 999;
}

.fab-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

#printBtn {
    display: none;
}

#menuView:not([style*="display: none"]) ~ #printBtn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: var(--white);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transition: bottom 0.3s ease;
    z-index: 3000;
    max-width: 500px;
    text-align: center;
}

.toast.show {
    bottom: 2rem;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-600);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.2rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .search-section,
    .fab-btn,
    .admin-header,
    .admin-tabs,
    .card-header .btn,
    .table-actions {
        display: none !important;
    }

    .menu-header {
        background: var(--primary-color) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body {
        background: white;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-actions {
        width: 100%;
        justify-content: center;
    }

    .nav-btn {
        flex: 1;
        justify-content: center;
    }

    .menu-header h1 {
        font-size: 2rem;
    }

    .menu-header p {
        font-size: 1rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .admin-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
        justify-content: center;
    }

    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .fab-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        bottom: 1rem;
        right: 1rem;
    }

    .table-container {
        overflow-x: scroll;
    }

    .data-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .admin-header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 1.5rem;
    }

    .card h2 {
        font-size: 1.4rem;
    }
}

/* === ESTILOS ESPECÍFICOS PARA PÁGINAS === */

/* Menu Page (index.html) */
.menu-page {
    background-color: var(--bg-color);
}

.company-logo {
    max-width: 200px;
    max-height: 80px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.category-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.category-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.menu-footer {
    background: var(--white);
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    position: relative;
}

.menu-footer .container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.menu-footer p {
    color: var(--gray-600);
    margin: 0;
}

.admin-link {
    position: absolute;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--gray-200);
    color: var(--gray-600);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.2rem;
}

.admin-link:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: rotate(90deg);
}

/* Admin Page (admin.html) */
.admin-page {
    background-color: var(--bg-color);
    min-height: 100vh;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

/* Ajustes responsivos para footer */
@media (max-width: 768px) {
    .menu-footer .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .admin-link {
        position: static;
    }
    
    .category-title {
        font-size: 1.5rem;
    }
    
    .category-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Print otimizado para menu */
@media print {
    .menu-footer,
    .admin-link,
    .search-section {
        display: none !important;
    }
    
    .category-section {
        page-break-inside: avoid;
    }
    
    .category-title {
        color: var(--primary-color) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* === COMPONENTE DE UPLOAD DE IMAGENS === */

.image-upload-wrapper {
    width: 100%;
}

.image-upload-area {
    width: 100%;
    min-height: 250px;
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    background: var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--white);
}

.image-upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(231, 76, 60, 0.05);
    transform: scale(1.02);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    height: 100%;
    min-height: 250px;
}

.upload-placeholder i {
    font-size: 4rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.upload-placeholder p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.upload-placeholder small {
    display: block;
    color: var(--gray-600);
    margin-bottom: 0.3rem;
}

.upload-limits {
    color: var(--warning-color) !important;
    font-weight: 600;
}

.upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    min-height: 250px;
    background: var(--white);
}

.upload-preview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
}

.remove-image-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--danger-color);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.remove-image-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.upload-error {
    margin-top: 0.5rem;
    padding: 0.8rem;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    color: var(--danger-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Responsivo para upload */
@media (max-width: 768px) {
    .image-upload-area {
        min-height: 200px;
    }
    
    .upload-placeholder {
        padding: 2rem 1rem;
        min-height: 200px;
    }
    
    .upload-placeholder i {
        font-size: 3rem;
    }
    
    .upload-placeholder p {
        font-size: 1rem;
    }
    
    .upload-preview {
        min-height: 200px;
    }
    
    .upload-preview img {
        max-height: 200px;
    }
}

/* === ESTATÍSTICAS (MASTER ADMIN) === */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--white);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-color);
}

.stat-content p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0;
}

.powered-by {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-600);
}

/* Responsivo para stats */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .stat-content h3 {
        font-size: 1.5rem;
    }
}
