/* 
 * YellowSistem - Tailwind Compatibility Layer v2
 * Mapeia classes Bootstrap para estilos Tailwind-like
 * Compatível com Tailwind via CDN (sem @apply)
 */

/* ============================================
   BOTÕES - Bootstrap → Tailwind-like
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    gap: 0.5rem;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.3);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* Primary Button - Amarelo YellowSistem */
.btn-primary {
    background: linear-gradient(135deg, #FFC400 0%, #FFB300 100%);
    color: #000;
    box-shadow: 0 2px 8px rgba(255, 196, 0, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #FFD740 0%, #FFC400 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 196, 0, 0.4);
}

/* Secondary Button */
.btn-secondary {
    background: #4b5563;
    color: #fff;
}

.btn-secondary:hover {
    background: #374151;
}

/* Success Button */
.btn-success {
    background: #22c55e;
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
}

/* Danger Button */
.btn-danger {
    background: #ef4444;
    color: #fff;
}

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

/* Warning Button */
.btn-warning {
    background: #f59e0b;
    color: #000;
}

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

/* Info Button */
.btn-info {
    background: #3b82f6;
    color: #fff;
}

.btn-info:hover {
    background: #2563eb;
}

/* Outline Variants */
.btn-outline-primary {
    border: 2px solid #FFC400;
    color: #FFC400;
    background: transparent;
}

.btn-outline-primary:hover {
    background: #FFC400;
    color: #000;
}

.btn-outline-secondary {
    border: 2px solid #6b7280;
    color: #6b7280;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #6b7280;
    color: #fff;
}

.btn-outline-danger {
    border: 2px solid #ef4444;
    color: #ef4444;
    background: transparent;
}

.btn-outline-danger:hover {
    background: #ef4444;
    color: #fff;
}

/* Icon Button */
.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
    background: transparent;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   FORMULÁRIOS - Premium Responsivo
   ============================================ */

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

[data-theme="dark"] .form-label {
    color: #d1d5db;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: #111827;
    background-color: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #FFC400;
    box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.15);
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-control:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-control.is-invalid {
    border-color: #ef4444;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .form-control {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
}

[data-theme="dark"] .form-control::placeholder {
    color: #6b7280;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    accent-color: #FFC400;
}

.form-check-label {
    font-size: 0.875rem;
    color: #374151;
}

[data-theme="dark"] .form-check-label {
    color: #d1d5db;
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.invalid-feedback {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #ef4444;
}

/* ============================================
   ALERTAS - Modernos com borda lateral
   ============================================ */

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #dcfce7;
    border-left-color: #22c55e;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    border-left-color: #ef4444;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-left-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-left-color: #3b82f6;
    color: #1e40af;
}

[data-theme="dark"] .alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

[data-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

[data-theme="dark"] .alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

/* ============================================
   CARDS - Glassmorphism moderno
   ============================================ */

.card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

[data-theme="dark"] .card {
    background: #1f2937;
    border-color: #374151;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

[data-theme="dark"] .card-header {
    border-bottom-color: #374151;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #f9fafb;
}

[data-theme="dark"] .card-footer {
    background: #111827;
    border-top-color: #374151;
}

/* ============================================
   BADGES - Pills modernos
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
}

.badge-primary {
    background: rgba(255, 196, 0, 0.2);
    color: #92400e;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

[data-theme="dark"] .badge-primary {
    background: rgba(255, 196, 0, 0.3);
    color: #fcd34d;
}

[data-theme="dark"] .badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

[data-theme="dark"] .badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .badge-secondary {
    background: #374151;
    color: #d1d5db;
}

/* ============================================
   TABELAS - Responsivas
   ============================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .table-responsive {
        margin: 0;
        padding: 0;
    }
}

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

.table thead {
    background: #f9fafb;
}

[data-theme="dark"] .table thead {
    background: #1f2937;
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .table td {
    border-bottom-color: #374151;
}

.table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   LAYOUT ADMIN - Mobile First
   ============================================ */

.admin-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .admin-layout {
        flex-direction: row;
    }
}

/* Sidebar - REMOVIDO pois conflita com CSS inline do sidebar_admin.html */
/* Os estilos da sidebar são definidos diretamente no template */

/* Overlay mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    /* Atrás da sidebar (1000) */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 768px) {
    .sidebar-overlay {
        display: none;
    }
}

/* Admin Content */
.admin-content {
    flex: 1;
    padding: 1rem;
    min-width: 0;
    background: #f3f4f6;
}

@media (min-width: 768px) {
    .admin-content {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .admin-content {
        padding: 2rem;
    }
}

[data-theme="dark"] .admin-content {
    background: #111827;
}

/* ============================================
   GRID RESPONSIVO
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

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

@media (min-width: 768px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   MODAIS - Responsivos
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active,
.modal.show {
    display: flex;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 10;
}

[data-theme="dark"] .modal-content {
    background: #1f2937;
}

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

[data-theme="dark"] .modal-header {
    border-bottom-color: #374151;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #374151;
}

/* ============================================
   UTILIDADES MOBILE
   ============================================ */

/* Hide on mobile */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
}

/* Show only on mobile */
.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
}

/* Flex mobile utils */
.flex-col-mobile {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .flex-col-mobile {
        flex-direction: row;
    }
}

/* Text utilities */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Safe area for iOS */
.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 1rem);
}

/* ============================================
   PREMIUM COMPONENTS
   ============================================ */

/* Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem;
}

[data-theme="dark"] .glass-card {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Premium Button */
.btn-premium {
    background: linear-gradient(135deg, #FFC400 0%, #FFB300 100%);
    color: #000;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 15px rgba(255, 196, 0, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 196, 0, 0.4);
}

/* Navbar Premium */
.navbar-premium {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .navbar-premium {
    background: rgba(17, 24, 39, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #374151;
}

.mobile-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .mobile-menu-btn {
    color: #d1d5db;
}

[data-theme="dark"] .mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.25rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* ============================================
   SCROLLBAR CUSTOM
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}