/**
 * Estilos responsivos para a área do cliente
 * Aplicando as mesmas técnicas de responsividade da loja
 */

/* Estilos gerais para dispositivos móveis */
@media (max-width: 767.98px) {
    /* Ajustes de espaçamento e margens */
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .card {
        margin-bottom: 15px;
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        border: none;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Ajustes para tabelas em dispositivos móveis */
    .table-responsive {
        border: 0;
        margin-bottom: 0;
    }
    
    /* Ajustes para botões em dispositivos móveis */
    .btn {
        padding: 0.375rem 0.75rem;
        border-radius: 6px;
    }
    
    .btn-primary {
        background-color: #0d6efd;
        border-color: #0d6efd;
    }
    
    .btn-success {
        background-color: #198754;
        border-color: #198754;
    }
    
    .btn-danger {
        background-color: #dc3545;
        border-color: #dc3545;
    }
    
    .btn-warning {
        background-color: #ffc107;
        border-color: #ffc107;
        color: #212529;
    }
    
    .btn-info {
        background-color: #0dcaf0;
        border-color: #0dcaf0;
        color: #212529;
    }
    
    /* Ajustes para formulários em dispositivos móveis */
    .form-control {
        font-size: 16px; /* Evita zoom automático em iPhones */
        border-radius: 6px;
        border: 1px solid #ced4da;
    }
    
    .form-control:focus {
        border-color: #86b7fe;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    }
    
    /* Ajustes para o cabeçalho */
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    /* Implementação de acordeão para seções em dispositivos móveis */
    .mobile-accordion .accordion-button::after {
        margin-left: auto;
    }
    
    .mobile-accordion .card-header {
        padding: 0.75rem 1rem;
    }
    
    /* Reordenação de elementos em dispositivos móveis */
    .mobile-order-1 {
        order: 1;
    }
    
    .mobile-order-2 {
        order: 2;
    }
    
    /* Ajustes para o dashboard */
    .dashboard-stats .card {
        margin-bottom: 10px;
    }
    
    .dashboard-stats .card-body {
        padding: 10px;
    }
    
    /* Ajustes para o carrinho */
    .cart-item-image {
        max-width: 60px;
    }
    
    /* Ajustes para os pedidos */
    .pedido-detalhe .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pedido-detalhe .card-header .btn {
        margin-top: 10px;
    }
    
    /* Ajustes para campos de busca */
    .search-input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Ajustes para filtros */
    .filter-container {
        flex-direction: column;
    }
    
    .filter-container .form-select,
    .filter-container .form-control {
        margin-bottom: 10px;
        width: 100%;
    }
    
    /* Ajustes para a página de perfil */
    .card-header {
        flex-wrap: wrap;
        background-color: #f8f9fa;
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }
    
    .card-header .btn-sm {
        margin-top: 10px;
        width: auto;
    }
    
    /* Em telas pequenas, o botão voltar fica abaixo do título */
    @media (max-width: 575.98px) {
        .card-header {
            flex-direction: column;
            align-items: flex-start;
        }
        
        .card-header .btn {
            margin-top: 10px;
            align-self: flex-start;
        }
    }
    
    /* Estilos para cabeçalho e rodapé mobile com comportamento de app */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background-color: #0d6efd;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        z-index: 1030;
        padding: 10px 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
    }
    
    .mobile-header-title {
        font-size: 1.2rem;
        font-weight: 600;
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 60%;
        color: #fff;
    }
    
    .mobile-header-back {
        border: none;
        background: transparent;
        padding: 5px;
        display: flex;
        align-items: center;
        color: #fff;
    }
    
    .mobile-header-action {
        border: none;
        background: transparent;
        padding: 5px;
        display: flex;
        align-items: center;
        color: #fff;
    }
    
    .mobile-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #fff;
        box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
        z-index: 1030;
        display: flex;
        align-items: center;
        justify-content: space-around;
        height: 60px;
        padding: 5px 0;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    .mobile-footer-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #6c757d;
        text-decoration: none;
        font-size: 0.7rem;
        padding: 5px 0;
        width: 20%;
    }
    
    .mobile-footer-item.active {
        color: #0d6efd;
    }
    
    .mobile-footer-item i {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }
    
    /* Ajuste para o conteúdo principal com cabeçalho e rodapé fixos */
    .mobile-content {
        padding-top: 90px;
        padding-bottom: 80px;
        min-height: 100vh;
    }
    
    /* Efeito de toque para itens do menu */
    .mobile-footer-item:active,
    .mobile-header-back:active,
    .mobile-header-action:active {
        opacity: 0.7;
    }
    
    /* Animações para transições */
    .mobile-fade-in {
        animation: fadeIn 0.3s ease-in-out;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* Esconde a barra lateral em dispositivos móveis */
    .sidebar {
        display: none;
    }
    
    /* Ajusta o conteúdo principal para ocupar toda a largura */
    main.col-md-9 {
        width: 100%;
        margin-left: 0;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Ajuste para o botão de chat/ajuda */
    .chat-button-container {
        position: fixed;
        bottom: 70px !important;
        right: 15px;
        z-index: 1025;
    }
    
    .chat-button {
        background-color: #0d6efd;
        color: white;
        border-radius: 50px;
        padding: 10px 15px;
        display: flex;
        align-items: center;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
        text-decoration: none;
        transition: all 0.3s ease;
    }
    
    .chat-button:hover, 
    .chat-button:focus {
        background-color: #0b5ed7;
        color: white;
        text-decoration: none;
    }
    
    .chat-button i {
        margin-right: 8px;
        font-size: 1.2rem;
    }
    
    /* Estilos para botões de ação */
    .btn i {
        margin-right: 5px;
    }
    
    .action-buttons .btn {
        margin-right: 5px;
        margin-bottom: 5px;
    }
    
    /* Melhorias visuais para cards e elementos */
    .card-title {
        color: #0d6efd;
        font-weight: 600;
    }
    
    .badge {
        font-weight: 500;
        padding: 0.35em 0.65em;
        border-radius: 50rem;
    }
    
    /* Estilos para status de pedidos */
    .badge-pendente {
        background-color: #ffc107;
        color: #212529;
    }
    
    .badge-aprovado {
        background-color: #0dcaf0;
        color: #212529;
    }
    
    .badge-em_separacao, 
    .badge-em_transporte {
        background-color: #0d6efd;
        color: #fff;
    }
    
    .badge-entregue {
        background-color: #198754;
        color: #fff;
    }
    
    .badge-cancelado {
        background-color: #dc3545;
        color: #fff;
    }
}

/* Estilos para dispositivos muito pequenos */
@media (max-width: 575.98px) {
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
    
    /* Ajustes para tabelas em dispositivos muito pequenos */
    .table-sm-responsive th,
    .table-sm-responsive td {
        padding: 0.5rem;
    }
    
    /* Esconde colunas menos importantes em telas muito pequenas */
    .hide-xs {
        display: none;
    }
    
    /* Ajustes para botões em dispositivos muito pequenos */
    .btn-group-sm > .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Ajustes específicos para a página de perfil em telas muito pequenas */
    .card-header .btn-sm {
        width: 100%;
        margin-top: 10px;
    }
    
    /* Campos de senha em coluna única em telas muito pequenas */
    .perfil-senha-row {
        flex-direction: column;
    }
    
    .perfil-senha-row > div {
        width: 100%;
    }
    
    /* Ajustes para o cabeçalho e rodapé em telas muito pequenas */
    .mobile-header-title {
        font-size: 1.1rem;
        max-width: 50%;
    }
    
    .mobile-footer-item {
        font-size: 0.65rem;
    }
    
    .mobile-footer-item i {
        font-size: 1.2rem;
    }
    
    /* Ajuste para o botão de chat em telas muito pequenas */
    .chat-button span {
        display: none;
    }
    
    .chat-button i {
        margin-right: 0;
    }
    
    .chat-button {
        width: 50px;
        height: 50px;
        justify-content: center;
        border-radius: 50%;
    }
}

/* Variáveis de cores */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
}

/* Estilos gerais para mobile */
body {
    padding: 0;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
}

/* Cabeçalho mobile com comportamento de app */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-header-title {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.mobile-header-back,
.mobile-header-action {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.mobile-header-back:hover,
.mobile-header-action:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-header-actions {
    display: flex;
    align-items: center;
}

/* Rodapé mobile com comportamento de app */
.mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1020;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
    border-top: 1px solid var(--gray-200);
}

.mobile-footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.7rem;
    padding: 5px 0;
    width: 20%;
    transition: color 0.2s;
}

.mobile-footer-item i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.mobile-footer-item.active {
    color: var(--secondary-color);
}

.mobile-footer-item:hover,
.mobile-footer-item:focus {
    color: var(--secondary-color);
}

/* Conteúdo principal */
.mobile-content {
    padding-top: 90px;
    padding-bottom: 70px;
    min-height: calc(100vh - 130px);
}

/* Cards para visualização em dispositivos móveis */
.produto-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 10px;
    overflow: hidden;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.produto-card:hover,
.produto-card:focus {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Estilo para botões */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: #2980b9;
    border-color: #2980b9;
}

/* Feedback visual para toque em dispositivos móveis */
.touch-active {
    opacity: 0.7;
    transition: opacity 0.1s;
}

/* Ajustes para o chat widget */
.chat-widget {
    position: fixed;
    bottom: 70px; /* Posicionado acima do rodapé mobile */
    right: 15px;
    z-index: 1019; /* Abaixo do rodapé e cabeçalho */
}

.chat-widget-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.chat-widget-button:hover,
.chat-widget-button:focus {
    background-color: #2980b9;
    transform: scale(1.05);
}

.chat-widget-button i {
    font-size: 1.5rem;
}

.chat-widget-container {
    position: fixed;
    bottom: 70px; /* Posicionado acima do rodapé mobile */
    right: 15px;
    width: calc(100% - 30px);
    max-width: 350px;
    height: 400px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1019;
    transition: all 0.3s;
    transform-origin: bottom right;
}

.chat-widget-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-widget-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.chat-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: var(--gray-100);
}

.chat-widget-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid var(--gray-200);
}

.chat-widget-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    margin-right: 10px;
}

.chat-widget-input button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    cursor: pointer;
}

.chat-message {
    margin-bottom: 10px;
    max-width: 80%;
}

.chat-message-user {
    margin-left: auto;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 18px 18px 0 18px;
    padding: 10px 15px;
}

.chat-message-support {
    margin-right: auto;
    background-color: white;
    border-radius: 18px 18px 18px 0;
    padding: 10px 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message-time {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 5px;
    text-align: right;
}

/* Seção de ajuda */
.help-section {
    position: relative;
    padding: 20px 15px;
    margin-bottom: 70px; /* Espaço para o rodapé mobile */
    background-color: var(--light-color);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.help-section h5 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.help-section p {
    color: var(--gray-700);
    margin-bottom: 15px;
}

.help-section .btn {
    margin-top: 5px;
}

/* Ajustes para formulários */
.form-control {
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    padding: 10px 12px;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Badges e indicadores */
.badge {
    font-weight: 500;
    padding: 5px 8px;
    border-radius: 4px;
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Ajustes para o menu offcanvas */
.offcanvas-header {
    background-color: var(--primary-color);
    color: white;
}

.offcanvas-title {
    font-weight: 500;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.offcanvas-body .nav-link {
    color: var(--gray-700);
    padding: 10px 15px;
    border-radius: 6px;
    transition: all 0.2s;
}

.offcanvas-body .nav-link:hover,
.offcanvas-body .nav-link:focus {
    background-color: var(--gray-100);
    color: var(--secondary-color);
}

.offcanvas-body .nav-link.active {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--secondary-color);
    font-weight: 500;
}

/* Media queries para ajustes específicos */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card {
        border-radius: 10px;
    }
    
    .card-header {
        border-radius: 10px 10px 0 0 !important;
    }
}
