/* CSS Responsivo Melhorado para o Painel Administrativo */

/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sidebar-header h2 i {
    margin-right: 0.5rem;
    color: #ffd700;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    margin: 0.25rem 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: #ffd700;
    transform: translateX(5px);
}

.sidebar-menu a.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #ffd700;
    font-weight: 600;
}

.sidebar-menu a i {
    margin-right: 1rem;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: #5a6fd8;
    transform: scale(1.05);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 2rem;
    color: #2c3e50;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-info span {
    color: #666;
    font-weight: 500;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h3 {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.2rem;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin: -1.5rem;
    padding: 1.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error,
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

.badge-primary {
    background: #667eea;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.modal-header h3 {
    color: #2c3e50;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8f9fa;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #667eea;
}

/* Plan Cards */
.plan-card {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: white;
    transition: all 0.3s ease;
}

.plan-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.1);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 1rem;
}

.plan-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.info-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-active .status-dot {
    background-color: #28a745;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.status-inactive .status-dot {
    background-color: #dc3545;
}

.status-warning {
    background-color: #fff3cd;
    color: #856404;
}

.status-warning .status-dot {
    background-color: #ffc107;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
    
    .plan-info {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .plan-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .plan-info {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table-responsive {
        margin: -1rem;
        padding: 1rem;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
        padding-top: 4rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.6rem;
    }
    
    .info-item {
        padding: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 98%;
    }
    
    .modal-header,
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .card {
        background: #2d2d2d;
        border: 1px solid #404040;
    }
    
    .card-header {
        background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
        border-bottom-color: #404040;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .table {
        background: #2d2d2d;
    }
    
    .table th {
        background: #404040;
        color: #e0e0e0;
    }
    
    .table tbody tr:hover {
        background: #404040;
    }
    
    .modal-content {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .modal-header {
        background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
        border-bottom-color: #404040;
    }
    
    .modal-footer {
        background: #404040;
        border-top-color: #404040;
    }
}



/* Melhorias específicas para mobile */
@media (max-width: 768px) {
    /* Botões de ação em tabelas */
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 120px;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Tabelas responsivas melhoradas */
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .table {
        min-width: 600px; /* Força scroll horizontal quando necessário */
    }
    
    /* Cards de estatísticas em mobile */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
        text-align: center;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin: 0 auto 0.5rem;
    }
    
    .stat-info h4 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .stat-info p {
        font-size: 0.8rem;
    }
    
    /* Formulários em mobile */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    /* Filtros em mobile */
    .filters {
        padding: 0.75rem;
    }
    
    .filters form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .filters form > div {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .filters label {
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    .filters select,
    .filters input {
        padding: 0.5rem;
        border-radius: 6px;
        border: 1px solid #ddd;
    }
    
    /* Sidebar melhorada para mobile */
    .sidebar {
        box-shadow: 2px 0 20px rgba(0,0,0,0.3);
    }
    
    .sidebar-menu a {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .sidebar-menu a i {
        margin-right: 0.75rem;
        width: 18px;
    }
    
    /* Overlay para sidebar mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Badges responsivos */
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* Melhorias para campos editáveis */
    .editable-field {
        min-width: 60px;
        text-align: center;
        padding: 0.5rem;
        border-radius: 4px;
        background: #f8f9fa;
        border: 1px solid #dee2e6;
    }
    
    .edit-input {
        width: 80px;
        padding: 0.25rem;
        text-align: center;
        border: 2px solid #667eea;
        border-radius: 4px;
    }
    
    .save-btn, .cancel-btn {
        padding: 0.25rem 0.5rem;
        margin: 0 0.125rem;
        border-radius: 3px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    /* Ajustes para telas muito pequenas */
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem 0.5rem;
    }
    
    .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .stat-info h4 {
        font-size: 1.25rem;
    }
    
    .stat-info p {
        font-size: 0.7rem;
    }
    
    /* Botões menores em telas pequenas */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Tabelas em telas pequenas */
    .table th,
    .table td {
        padding: 0.375rem 0.25rem;
        font-size: 0.75rem;
        vertical-align: middle;
    }
    
    /* Modal em telas pequenas */
    .modal-content {
        margin: 2% auto;
        width: 100%;
        height: 96vh;
        border-radius: 8px 8px 0 0;
    }
    
    .modal-body {
        max-height: calc(96vh - 120px);
        overflow-y: auto;
    }
}

/* Melhorias para touch */
@media (hover: none) and (pointer: coarse) {
    /* Dispositivos touch */
    .btn {
        min-height: 44px; /* Tamanho mínimo recomendado para touch */
        padding: 0.75rem 1rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
    }
    
    .sidebar-menu a {
        min-height: 48px;
        padding: 1rem 1.5rem;
    }
    
    .editable-field {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Aumentar área de toque para elementos pequenos */
    .close {
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .save-btn, .cancel-btn {
        min-width: 36px;
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Animações suaves para mobile */
@media (max-width: 768px) {
    .card {
        transition: none; /* Remover animações em mobile para melhor performance */
    }
    
    .btn {
        transition: background-color 0.2s ease;
    }
    
    .sidebar {
        transition: transform 0.25s ease;
    }
}

/* Modo paisagem em mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        padding: 0.75rem;
        padding-top: 3.5rem;
    }
    
    .page-header {
        margin-bottom: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .modal-content {
        margin: 1% auto;
        height: 98vh;
    }
}