/* Admin Styles */
:root {
    --primary: #2a5298;
    --white: #ffffff;
    --dark: #333333;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 120px;
    height: auto;
    margin-bottom: 1rem;
}

.login-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
    font-family: 'Oswald', sans-serif;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #2a5298;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    background: #2a5298;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.login-btn:hover {
    background: #1e3c72;
}

.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 5px;
    text-align: center;
    font-weight: 500;
}

.message.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.message.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Mobile Debug Styles */
.mobile-debug {
    margin-top: 20px;
    position: relative;
}

.debug-toggle {
    width: 100%;
    padding: 10px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.debug-toggle:hover {
    background: #34495e;
}

.debug-panel {
    display: none;
    margin-top: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.debug-panel.active {
    display: block;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.debug-header h3 {
    margin: 0;
    font-size: 16px;
    color: #495057;
}

.debug-clear {
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
}

.debug-clear:hover {
    background: #c82333;
}

.debug-logs {
    min-height: 100px;
    max-height: 150px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 10px;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

.debug-log-entry {
    margin-bottom: 5px;
    padding: 3px 0;
    border-bottom: 1px solid #f1f3f4;
}

.debug-log-entry:last-child {
    border-bottom: none;
}

.debug-log-time {
    color: #6c757d;
    font-size: 10px;
}

.debug-log-level {
    font-weight: bold;
    margin-right: 5px;
}

.debug-log-level.info {
    color: #17a2b8;
}

.debug-log-level.error {
    color: #dc3545;
}

.debug-log-level.success {
    color: #28a745;
}

.debug-log-level.warning {
    color: #ffc107;
}

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

.debug-test-login,
.debug-fill-form {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.debug-test-login:hover,
.debug-fill-form:hover {
    background: #0056b3;
}

.debug-fill-form {
    background: #28a745;
}

.debug-fill-form:hover {
    background: #1e7e34;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .debug-panel {
        max-height: 250px;
    }
    
    .debug-logs {
        max-height: 120px;
        font-size: 11px;
    }
    
    .debug-actions {
        flex-direction: column;
    }
    
    .debug-test-login,
    .debug-fill-form {
        width: 100%;
        min-width: auto;
    }
}

/* Admin Dashboard */
.admin-dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: #2a5298 !important;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-logo img {
    width: 60px;
    height: auto;
}

.admin-logo h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Navigation */
.admin-nav {
    background: white;
    border-bottom: 1px solid #e1e1e1;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 0;
}

.nav-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.nav-btn:hover {
    color: #2a5298;
    background: #f8f9fa;
}

.nav-btn.active {
    color: #2a5298;
    border-bottom-color: #2a5298;
}

.nav-btn i {
    margin-right: 0.5rem;
}

/* Content */
.admin-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.tab-content {
    display: none;
}

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

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e1e1e1;
}

.tab-header h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    color: #333;
}

.add-btn {
    padding: 0.75rem 1.5rem;
    background: #2a5298 !important;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.add-btn:hover {
    background: #1e3c72;
}

/* Cardápio List */
.cardapio-list {
    display: grid;
    gap: 1rem;
}

.cardapio-item {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: box-shadow 0.3s;
}

.cardapio-item:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.cardapio-item.inactive {
    opacity: 0.6;
    background: #f8f9fa;
    border-color: #dee2e6;
}

.cardapio-item.inactive img {
    filter: grayscale(50%);
}

.status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    margin-left: 10px;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.inactive {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.reactivate-btn {
    background-color: #28a745;
    color: white;
}

.reactivate-btn:hover {
    background-color: #218838;
}

.permanent-delete-btn {
    background-color: #6c757d;
    color: white;
    border: 2px solid #dc3545;
}

.permanent-delete-btn:hover {
    background-color: #dc3545;
    transform: scale(1.05);
}

.cardapio-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cardapio-info {
    flex: 1;
}

.cardapio-info h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.cardapio-info p {
    color: #666;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.cardapio-price {
    font-weight: bold;
    color: #2a5298;
    font-size: 1.1rem;
}

.cardapio-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.edit-btn {
    background: #ffc107;
    color: #333;
}

.edit-btn:hover {
    background: #e0a800;
}

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

.delete-btn:hover {
    background: #c82333;
}

/* Pedidos List */
.pedidos-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pedido-item {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary);
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.pedido-info h4 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.pedido-info p {
    margin: 5px 0;
    color: var(--dark);
}

.pedido-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-select {
    padding: 8px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    background: var(--white);
    font-size: 0.9rem;
    cursor: pointer;
}

.status-select:focus {
    outline: none;
    border-color: var(--primary);
}

.pedido-details {
    border-top: 1px solid #e1e1e1;
    padding-top: 15px;
}

.pedido-items h5 {
    margin-bottom: 10px;
    color: var(--dark);
}

.pedido-item-detail {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pedido-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.view-btn {
    background-color: #17a2b8;
}

.view-btn:hover {
    background-color: #138496;
}

/* Pedido Details Modal */
.pedido-details-full {
    display: grid;
    gap: 20px;
}

.cliente-info, .pedido-info, .itens-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.cliente-info h4, .pedido-info h4, .itens-info h4 {
    color: var(--primary);
    margin-bottom: 10px;
}

/* Upload de Imagem */
.image-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 2px dashed #e1e1e1;
    border-radius: 8px;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.image-upload-container:hover {
    border-color: #2a5298;
}

.image-file-input {
    display: none;
}

.image-preview-container {
    width: 200px;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
}

.image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-upload-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.select-image-btn {
    padding: 8px 16px;
    background-color: #2a5298;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.select-image-btn:hover {
    background-color: #1e3c72;
}

.item-header {
    border-bottom: 2px solid #2a5298;
    padding-bottom: 10px;
}

.item-detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e1e1e1;
}

.total-info {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 2px solid var(--primary);
    text-align: right;
    font-size: 1.1rem;
}

/* Clientes List */
.clientes-list {
    display: grid;
    gap: 1rem;
}

.cliente-item {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.3s;
}

.cliente-item:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

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

.cliente-nome {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.cliente-email {
    color: #2a5298;
    font-weight: 500;
}

.cliente-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.cliente-info p {
    color: #666;
    font-size: 0.9rem;
}

.cliente-info strong {
    color: #333;
}

/* Site Info Form */
.siteinfo-form {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 2rem;
}

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

.siteinfo-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.siteinfo-form input,
.siteinfo-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.siteinfo-form input:focus,
.siteinfo-form textarea:focus {
    outline: none;
    border-color: #2a5298;
}

.siteinfo-form textarea {
    resize: vertical;
    min-height: 100px;
}

.save-siteinfo-btn {
    padding: 0.75rem 2rem;
    background: #2a5298;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.save-siteinfo-btn:hover {
    background: #1e3c72;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e1e1e1;
}

.modal-header h3 {
    font-family: 'Oswald', sans-serif;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #333;
}

.modal-form {
    padding: 1.5rem;
}

.modal-form .form-group {
    margin-bottom: 1rem;
}

.modal-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.modal-form input,
.modal-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.modal-form input:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: #2a5298;
}

.modal-form textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e1e1;
}

.cancel-btn {
    padding: 0.75rem 1.5rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.cancel-btn:hover {
    background: #5a6268;
}

.save-btn {
    padding: 0.75rem 1.5rem;
    background: #2a5298;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.save-btn:hover {
    background: #1e3c72;
}

/* Mobile Menu Styles */
.admin-mobile-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1004;
}

.admin-mobile-toggle span {
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.admin-mobile-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.admin-mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.admin-mobile-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

.admin-mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    padding: 80px 20px 20px;
    overflow-y: auto;
}

.admin-mobile-nav.active {
    right: 0;
}

.mobile-admin-user {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
    text-align: center;
}

.mobile-admin-user span {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.mobile-nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-nav-buttons .nav-btn {
    width: 100%;
    padding: 15px;
    text-align: left;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.mobile-nav-buttons .nav-btn:hover,
.mobile-nav-buttons .nav-btn.active {
    background: #2a5298;
    color: white;
    border-color: #2a5298;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header-content {
        justify-content: space-between;
        align-items: center;
    }
    
    .admin-header-content h2 {
        font-size: 1.2rem;
    }
    
    .admin-mobile-toggle {
        display: flex;
    }
    
    .desktop-admin-user {
        display: none;
    }
    
    .desktop-admin-nav {
        display: none;
    }
    
    .admin-mobile-nav {
        display: block;
    }
    
    /* Forçar exibição correta do dashboard no mobile */
    .admin-dashboard {
        position: relative !important;
        z-index: 1002 !important;
        width: 100% !important;
        height: 100vh !important;
        overflow-y: auto !important;
    }
    
    /* Garantir que a tela de login seja completamente oculta */
    .login-screen {
        position: relative !important;
        z-index: 1 !important;
    }
    
    .login-screen[style*="display: none"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    .cardapio-item {
        flex-direction: column;
        text-align: center;
    }
    
    .cliente-info {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    /* Garantir que modais fiquem acima de tudo no mobile */
    .modal {
        z-index: 1005 !important;
    }
    
    .modal-content {
        position: relative;
        z-index: 1006 !important;
    }
    
    .admin-content {
        padding: 1rem;
    }
    
    .tab-header {
        margin-bottom: 1rem;
    }
    
    .tab-header h3 {
        font-size: 1.3rem;
    }
}