/**
 * SISTEMA DE CARDS RESPONSIVOS
 * Converte tabelas em cards em telas pequenas
 */

/* ====================================
   UTILITÁRIOS GERAIS DE RESPONSIVIDADE
   ==================================== */

/* Container responsivo */
.responsive-container {
    width: 100%;
    padding: 1rem;
}

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

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

/* Grid responsivo */
.responsive-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

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

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

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

/* ====================================
   SISTEMA DE TABELAS RESPONSIVAS
   ==================================== */

/* Container de tabela responsiva */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tabela padrão - desktop */
.responsive-table {
    width: 100%;
    border-collapse: collapse;
    background: #18181b;
    border-radius: 8px;
    overflow: hidden;
}

.responsive-table thead {
    background: #27272a;
}

.responsive-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #fafafa;
    border-bottom: 2px solid #3f3f46;
}

.responsive-table td {
    padding: 12px 16px;
    color: #d4d4d8;
    border-bottom: 1px solid #3f3f46;
}

.responsive-table tr:hover {
    background: #27272a;
}

/* Mobile: esconder tabela e mostrar cards */
@media (max-width: 767px) {
    .responsive-table {
        display: none;
    }

    .mobile-cards-container {
        display: block;
    }
}

/* Desktop: mostrar tabela e esconder cards */
@media (min-width: 768px) {
    .mobile-cards-container {
        display: none !important;
    }

    .responsive-table {
        display: table;
    }
}

/* ====================================
   CARDS PARA MOBILE
   ==================================== */

.mobile-cards-container {
    display: none; /* Escondido por padrão, aparece só no mobile */
    flex-direction: column;
    gap: 1rem;
}

.mobile-card {
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.mobile-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #3f3f46;
}

.mobile-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fafafa;
    flex: 1;
}

.mobile-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.mobile-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
}

.mobile-card-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #a1a1aa;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.mobile-card-value {
    font-size: 0.875rem;
    color: #d4d4d8;
    text-align: right;
    flex: 1;
    margin-left: 0.5rem;
}

.mobile-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #3f3f46;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ====================================
   BADGES E TAGS RESPONSIVOS
   ==================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .badge {
        font-size: 0.6875rem;
        padding: 0.1875rem 0.5rem;
    }
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fb923c;
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge-neutral {
    background: rgba(161, 161, 170, 0.15);
    color: #a1a1aa;
}

/* ====================================
   BOTÕES RESPONSIVOS
   ==================================== */

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

@media (max-width: 640px) {
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }

    /* Botões pequenos no mobile */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Esconder texto, mostrar só ícone em botões com classe .mobile-icon-only */
    .btn.mobile-icon-only span {
        display: none;
    }
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

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

.btn-secondary {
    background: #22c55e;
    color: white;
}

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

.btn-danger {
    background: #ef4444;
    color: white;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid #3f3f46;
    color: #d4d4d8;
}

.btn-outline:hover {
    background: #27272a;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
}

@media (max-width: 640px) {
    .btn-icon {
        width: 1.75rem;
        height: 1.75rem;
    }
}

/* ====================================
   FORMULÁRIOS RESPONSIVOS
   ==================================== */

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

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

.form-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #3f3f46;
    border-radius: 0.5rem;
    background: #18181b;
    color: #ffffff;
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    .form-input {
        font-size: 16px; /* Previne zoom no iOS */
    }
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ====================================
   MODAL RESPONSIVO
   ==================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: #18181b;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}

@media (max-width: 640px) {
    .modal-content {
        padding: 1rem;
        max-height: 95vh;
    }
}

/* ====================================
   TEXTO RESPONSIVO
   ==================================== */

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .text-sm-responsive {
        font-size: 0.8125rem;
    }

    .text-xs-responsive {
        font-size: 0.75rem;
    }
}

/* ====================================
   ESPAÇAMENTOS RESPONSIVOS
   ==================================== */

.p-responsive {
    padding: 1rem;
}

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

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

.gap-responsive {
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .gap-responsive {
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .gap-responsive {
        gap: 1.5rem;
    }
}

/* ====================================
   HIDE/SHOW RESPONSIVO
   ==================================== */

.hide-mobile {
    display: none;
}

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

.show-mobile {
    display: initial;
}

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

/* ====================================
   CARDS DE ESTATÍSTICAS RESPONSIVOS
   ==================================== */

.stat-card {
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
    .stat-card {
        padding: 1rem;
    }
}

.stat-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

@media (max-width: 640px) {
    .stat-card-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 600;
    color: #fafafa;
}

@media (max-width: 640px) {
    .stat-card-value {
        font-size: 1.5rem;
    }
}

.stat-card-label {
    font-size: 0.875rem;
    color: #a1a1aa;
}

@media (max-width: 640px) {
    .stat-card-label {
        font-size: 0.75rem;
    }
}
