/* ============================================
   Mobile Responsive Design - Sistema Barbearia
   CORES PROFISSIONAIS DE BARBEARIA
   Super Otimizado para Mobile
   ============================================ */

/* ============================================
   VARIÁVEIS DE COR - BARBEARIA (sync com global.css)
   ============================================ */
:root {
    /* Cores Barbearia */
    --mobile-primary: #1e40af;
    --mobile-primary-dark: #1e3a8a;
    --mobile-secondary: #b91c1c;
    --mobile-secondary-dark: #991b1b;

    /* Gradientes Barbearia */
    --mobile-gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    --mobile-gradient-secondary: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
}

/* ============================================
   IMAGENS RESPONSIVAS
   ============================================ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Imagens dentro de cards e containers */
.card img,
.gallery-item img,
.blog-post img,
.service-card img,
.product-card img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Hero images responsivas */
.hero img,
.hero-image img,
.featured-image img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

/* ============================================
   MOBILE FIRST - Base Styles
   ============================================ */
.container {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   TABLET (768px - 1024px)
   ============================================ */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

/* ============================================
   DESKTOP (1025px+)
   ============================================ */
@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
    }
}

/* ============================================
   MOBILE (até 767px) - SUPER RESPONSIVO
   ============================================ */
@media (max-width: 767px) {

    /* Typography otimizada mobile */
    html {
        font-size: 14px;
        /* Base menor para mobile */
    }

    h1,
    .content-title,
    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    h4 {
        font-size: 1.125rem !important;
    }

    p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    /* Botões mobile - cores barbearia */
    .btn {
        width: 100% !important;
        justify-content: center;
        padding: 0.875rem 1.5rem !important;
        font-size: 1rem !important;
        border-radius: 0.75rem !important;
        font-weight: 600 !important;
    }

    .btn-primary {
        background: var(--mobile-gradient-primary) !important;
        color: white !important;
        border: none !important;
    }

    .btn-secondary {
        background: var(--mobile-gradient-secondary) !important;
        color: white !important;
        border: none !important;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-sm {
        padding: 0.625rem 1rem !important;
        font-size: 0.875rem !important;
        width: auto !important;
    }

    /* Cards super responsivos */
    .card {
        margin-bottom: 1rem;
        border-radius: 1rem !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
    }

    .card-header {
        padding: 1rem !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
        background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    }

    .card-body {
        padding: 1rem !important;
    }

    .card-footer {
        padding: 1rem !important;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Grid super responsivo */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4,
    .services-grid,
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Tabelas responsivas com scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 0.75rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    table {
        min-width: 600px;
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.75rem 0.5rem !important;
        white-space: nowrap;
    }

    table th {
        background: var(--mobile-gradient-primary) !important;
        color: white !important;
        font-weight: 600 !important;
    }

    /* Forms super responsivos */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important;
        /* Previne zoom no iOS */
        padding: 0.875rem !important;
        border-radius: 0.75rem !important;
        border: 2px solid #e5e7eb !important;
        width: 100% !important;
    }

    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        border-color: var(--mobile-primary) !important;
        box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1) !important;
    }

    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
        font-weight: 600;
        color: #374151;
    }

    /* Search input */
    .search-input {
        width: 100% !important;
        margin: 0.75rem 0 !important;
        padding: 0.875rem !important;
        font-size: 16px !important;
        border-radius: 0.75rem !important;
    }

    /* Content Header mobile */
    .content-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
        padding: 1rem !important;
    }

    .content-subtitle {
        font-size: 0.875rem;
    }

    .content-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Page Header mobile */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
        padding: 1rem !important;
        text-align: center !important;
    }

    /* Stats Cards mobile */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .stat-card {
        padding: 1.25rem !important;
        border-radius: 1rem !important;
        background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    }

    /* Alerts mobile */
    .alert {
        padding: 1rem !important;
        font-size: 0.875rem;
        margin-bottom: 1rem;
        border-radius: 0.75rem !important;
    }

    /* Badges mobile */
    .badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
        border-radius: 1rem;
    }

    .badge-primary {
        background: var(--mobile-primary) !important;
        color: white !important;
    }

    .badge-secondary {
        background: var(--mobile-secondary) !important;
        color: white !important;
    }

    /* Modais super responsivos mobile */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem !important;
        max-height: 90vh !important;
        overflow-y: auto;
        border-radius: 1rem !important;
    }

    .modal-header {
        padding: 1rem !important;
        background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
        border-radius: 1rem 1rem 0 0 !important;
    }

    .modal-body {
        padding: 1rem !important;
    }

    .modal-footer {
        padding: 1rem !important;
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .modal-footer .btn {
        width: 100% !important;
    }

    /* Agenda/Schedule mobile */
    .time-slots-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .time-slot {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
        border-radius: 0.5rem !important;
        text-align: center !important;
    }

    .time-slot.selected {
        background: var(--mobile-gradient-primary) !important;
        color: white !important;
    }

    /* Service Cards mobile */
    .service-card,
    .product-card {
        padding: 1rem !important;
        border-radius: 1rem !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
        transition: transform 0.2s ease !important;
    }

    .service-card:active,
    .product-card:active {
        transform: scale(0.98) !important;
    }

    .service-card h3,
    .product-card h3 {
        font-size: 1.125rem !important;
        color: var(--mobile-primary) !important;
    }

    /* Gallery mobile */
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .gallery-item {
        border-radius: 1rem !important;
        overflow: hidden;
    }

    /* Blog mobile */
    .blog-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .blog-post {
        padding: 0 !important;
        border-radius: 1rem !important;
        overflow: hidden;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
    }

    .blog-post .post-content {
        padding: 1rem !important;
    }

    /* Hero Section mobile */
    .hero {
        min-height: 60vh !important;
        padding: 2rem 1rem !important;
        text-align: center !important;
    }

    .hero h1 {
        font-size: 2rem !important;
    }

    .hero p {
        font-size: 1rem !important;
    }

    .hero-buttons {
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    /* Navigation mobile */
    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        width: 100%;
        padding: 0.875rem 1rem !important;
        text-align: left;
        border-radius: 0.5rem !important;
    }

    .nav-link:hover {
        background: rgba(30, 64, 175, 0.1) !important;
    }

    /* Spacing mobile otimizado */
    .mt-lg,
    .my-lg {
        margin-top: 1.5rem !important;
    }

    .mb-lg,
    .my-lg {
        margin-bottom: 1.5rem !important;
    }

    .p-lg {
        padding: 1rem !important;
    }

    /* Section spacing mobile */
    section {
        padding: 2rem 1rem !important;
    }

    /* Hide em mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Show apenas em mobile */
    .show-mobile {
        display: block !important;
    }

    /* Texto centralizado mobile */
    .text-center-mobile {
        text-align: center !important;
    }

    /* Footer mobile */
    footer,
    .footer {
        padding: 2rem 1rem !important;
        text-align: center !important;
    }

    .footer-links {
        flex-direction: column !important;
        gap: 1rem !important;
    }
}

/* ============================================
   ADMIN PANEL MOBILE
   ============================================ */
@media (max-width: 1024px) {

    /* Sidebar em mobile */
    .admin-sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1000;
        background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%) !important;
    }

    .admin-sidebar.show {
        left: 0;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    }

    /* Content ocupa tela toda em mobile */
    .admin-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 1rem !important;
    }

    /* Topbar mobile */
    .admin-topbar {
        padding: 1rem !important;
        background: var(--mobile-gradient-primary) !important;
    }

    .topbar-search {
        display: none;
        /* Ocultar busca em mobile */
    }

    .user-info {
        display: none;
        /* Ocultar info do usuário, só avatar */
    }

    .menu-toggle {
        display: flex !important;
        color: white !important;
    }

    /* Sidebar links mobile */
    .admin-sidebar .sidebar-link {
        padding: 1rem !important;
        color: white !important;
    }

    .admin-sidebar .sidebar-link:hover {
        background: rgba(255, 255, 255, 0.1) !important;
    }
}

/* ============================================
   SMALL MOBILE (até 420px)
   ============================================ */
@media (max-width: 420px) {
    html {
        font-size: 13px !important;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    h1,
    .content-title {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
    }

    .card {
        border-radius: 0.75rem !important;
    }

    .btn {
        padding: 0.75rem 1.25rem !important;
    }

    /* Time slots em uma coluna em telas muito pequenas */
    .time-slots-grid {
        grid-template-columns: 1fr !important;
    }

    /* Formulários em telas pequenas */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important;
        padding: 0.75rem !important;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-width: 767px) and (orientation: landscape) {
    .modal-content {
        max-height: 85vh !important;
    }

    .admin-sidebar.show {
        width: 200px;
    }

    .hero {
        min-height: 50vh !important;
    }
}

/* ============================================
   TOUCH OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {

    /* Aumentar área de toque */
    .btn,
    .nav-link,
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Feedback tátil */
    .btn:active,
    button:active {
        transform: scale(0.95);
    }

    /* Remover hover states */
    .btn:hover,
    .card:hover {
        transform: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    .admin-sidebar,
    .admin-topbar,
    .btn,
    .modal,
    .alert,
    nav,
    .navbar,
    .hero {
        display: none !important;
    }

    .admin-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    * {
        background: white !important;
        color: black !important;
    }
}

/* ============================================
   UTILITY CLASSES MOBILE
   ============================================ */
.text-center-mobile {
    text-align: center;
}

@media (min-width: 768px) {
    .text-center-mobile {
        text-align: left;
    }
}

.flex-column-mobile {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-column-mobile {
        flex-direction: row;
    }
}

.w-full-mobile {
    width: 100%;
}

@media (min-width: 768px) {
    .w-full-mobile {
        width: auto;
    }
}

/* Stack vertical em mobile */
.stack-mobile {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .stack-mobile {
        flex-direction: row;
    }
}

/* Padding responsivo */
.p-responsive {
    padding: 1rem;
}

@media (min-width: 768px) {
    .p-responsive {
        padding: 2rem;
    }
}

@media (min-width: 1025px) {
    .p-responsive {
        padding: 3rem;
    }
}