/* Custom styles for LXTelecom Ações */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Sidebar Navigation */
.nav-link.active {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #2d3a5c;
    transform: scale(1.05);
    shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.nav-link.active i {
    color: #2d3a5c;
}

/* Global Responsive Improvements */
* {
    box-sizing: border-box;
}

/* Desktop optimizations */
@media (min-width: 1280px) {
    .container-xl {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    /* Better spacing for large screens */
    .desktop-spacing {
        padding: 2rem;
    }
    
    /* Enhanced grid layouts */
    .desktop-grid-5 {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .desktop-grid-6 {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Tablet and desktop responsive improvements */
@media (min-width: 1024px) {
    /* Better sidebar for larger screens */
    #sidebar {
        width: 256px; /* Standard w-64 */
    }
    
    .lg\:ml-64 {
        margin-left: 256px; /* Standard ml-64 */
    }
    
    /* Enhanced form layouts */
    .form-grid-desktop {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Better table styling */
    .desktop-table th {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .desktop-table td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Enhanced cards */
    .desktop-card {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    /* Fix desktop container alignment */
    .desktop-container {
        max-width: none;
        padding: 1rem 1.5rem;
    }
    
    /* Better desktop spacing */
    .desktop-header {
        padding: 1rem 1.5rem;
    }
    
    /* Align desktop content properly */
    .desktop-content {
        padding: 1rem !important;
    }
    
    /* Ensure proper desktop layout */
    @media (min-width: 1024px) {
        main {
            padding-top: 5rem !important;
        }
        
        .desktop-section {
            margin-bottom: 2rem;
        }
        
        .desktop-card-container {
            padding: 1.5rem;
        }
        
        /* Better desktop grid alignment */
        .desktop-stats-grid {
            grid-template-columns: repeat(4, 1fr);
            gap: 1.5rem;
        }
        
        /* Desktop form improvements */
        .desktop-form {
            max-width: none;
        }
        
        .desktop-form-row {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1.5rem;
            margin-bottom: 1.5rem;
        }
    }
}

/* Mobile and tablet responsiveness */
@media (max-width: 1024px) {
    #sidebar.show {
        transform: translateX(0);
    }
    
    #sidebar-overlay.show {
        display: block;
    }
    
    /* Mobile-first form controls */
    input, select, textarea, button {
        min-height: 48px;
        font-size: 16px;
        border-radius: 12px;
        transition: all 0.3s ease;
    }
    
    input:focus, select:focus, textarea:focus {
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    }
    
    /* Better spacing for mobile */
    .mobile-form-group {
        margin-bottom: 1.5rem;
    }
    
    /* Enhanced touch targets */
    .btn-mobile {
        padding: 14px 20px;
        min-height: 52px;
        font-size: 16px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        transition: all 0.2s ease;
        font-weight: 600;
    }
    
    .btn-mobile:active {
        transform: scale(0.98);
    }
    
    /* Mobile table improvements */
    .mobile-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
        margin: 1rem 0;
    }
    
    .mobile-table {
        min-width: 700px;
        font-size: 14px;
    }
    
    /* Enhanced mobile cards */
    .mobile-card {
        background: white;
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.08);
        border: 1px solid #e5e7eb;
        transition: all 0.3s ease;
    }
    
    .mobile-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }
    
    /* Mobile navigation improvements */
    .mobile-nav-item {
        padding: 18px 16px;
        margin: 6px 12px;
        border-radius: 16px;
        transition: all 0.3s ease;
        font-weight: 500;
    }
    
    /* Sticky mobile controls */
    .mobile-sticky-controls {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 20px;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
        z-index: 20;
        border-radius: 20px 20px 0 0;
    }
    
    /* Enhanced mobile filters */
    .mobile-filter-toggle {
        background: linear-gradient(135deg, #3d4f7a 0%, #2d3a5c 100%);
        color: white;
        padding: 16px 24px;
        border-radius: 12px;
        border: none;
        font-size: 16px;
        font-weight: 600;
        width: 100%;
        margin-bottom: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 4px 12px rgba(61, 79, 122, 0.3);
        transition: all 0.3s ease;
    }
    
    .mobile-filter-toggle:active {
        transform: scale(0.98);
    }
    
    .mobile-filter-content {
        display: none;
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
        margin-bottom: 16px;
        border: 1px solid #e5e7eb;
    }
    
    .mobile-filter-content.show {
        display: block;
        animation: slideDown 0.4s ease;
    }
    
    @keyframes slideDown {
        from { 
            opacity: 0; 
            transform: translateY(-20px); 
            max-height: 0;
        }
        to { 
            opacity: 1; 
            transform: translateY(0); 
            max-height: 500px;
        }
    }
    
    /* Mobile dashboard improvements */
    .mobile-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Mobile stats cards */
    .mobile-stat-card {
        background: white;
        padding: 1.5rem;
        border-radius: 16px;
        text-align: center;
        box-shadow: 0 4px 16px rgba(0,0,0,0.08);
        transition: all 0.3s ease;
    }
    
    .mobile-stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }
}

/* Medium screens (tablets) */
@media (max-width: 768px) {
    /* Tablet-specific layouts */
    .tablet-grid-2 { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 1.5rem;
    }
    
    .tablet-grid-1 { 
        grid-template-columns: 1fr; 
        gap: 1rem;
    }
    
    /* Reduce padding on medium screens */
    .tablet-padding {
        padding: 1rem;
    }
    
    /* Better form layouts */
    .tablet-form-stack {
        flex-direction: column;
        gap: 1rem;
    }
    
    .tablet-form-stack > * {
        width: 100%;
    }
    
    /* Enhanced text sizing */
    .tablet-text-scale {
        font-size: 0.95rem;
    }
    
    /* Better button sizing */
    .tablet-btn {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
    }
}

/* Small screens (phones) */
@media (max-width: 480px) {
    /* Single column layouts */
    .mobile-single-col { 
        grid-template-columns: 1fr !important; 
        gap: 1rem;
    }
    
    /* Compact text */
    .mobile-text-sm {
        font-size: 14px;
    }
    
    .mobile-text-xs {
        font-size: 12px;
    }
    
    /* Compact buttons */
    .mobile-btn-compact {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
        border-radius: 10px;
    }
    
    /* Improved spacing */
    .mobile-space-tight {
        gap: 0.5rem;
    }
    
    .mobile-padding-sm {
        padding: 0.75rem;
    }
    
    /* Mobile-specific dashboard */
    .mobile-dashboard-single {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Enhanced mobile cards for small screens */
    .mobile-card-compact {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 12px;
    }
    
    /* Better mobile navigation */
    .mobile-nav-compact {
        padding: 14px 12px;
        margin: 4px 8px;
        font-size: 15px;
    }
    
    /* Improved sidebar for small screens */
    #sidebar {
        width: 280px;
    }
    
    /* Better mobile header */
    .mobile-header-compact {
        padding: 12px 16px;
    }
    
    .mobile-title-sm {
        font-size: 1.1rem;
        margin-left: 8px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    /* Very compact layouts */
    .xs-padding {
        padding: 0.5rem;
    }
    
    .xs-text {
        font-size: 13px;
    }
    
    .xs-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
    }
    
    /* Sidebar adjustments */
    #sidebar {
        width: 260px;
    }
    
    /* Header adjustments */
    .xs-header {
        padding: 10px 12px;
    }
}

/* Medium screens */
@media (max-width: 768px) {
    /* Adjust grid layouts */
    .grid-cols-2 { grid-template-columns: 1fr; }
    .grid-cols-3 { grid-template-columns: 1fr; }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    
    /* Reduce padding on smaller screens */
    .mobile-padding {
        padding: 12px;
    }
    
    /* Stack form elements */
    .flex-wrap {
        flex-direction: column;
    }
    
    .flex-wrap > * {
        width: 100%;
        margin-bottom: 12px;
    }
}

/* Small screens */
@media (max-width: 480px) {
    /* Single column layouts */
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { 
        grid-template-columns: 1fr; 
        gap: 12px;
    }
    
    /* Smaller text on very small screens */
    .text-sm-mobile {
        font-size: 14px;
    }
    
    /* Compact buttons */
    .btn-compact {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 40px;
    }
    
    /* Mobile-specific spacing */
    .mobile-space-y-4 > * + * {
        margin-top: 16px;
    }
}

.alert {
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

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

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(251, 191, 36, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.8), 0 0 30px rgba(251, 191, 36, 0.6);
    }
}

.lx-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.lx-gradient-animate {
    background-size: 400% 400%;
    animation: gradient-shift 6s ease infinite;
}

/* Hover effects */
.hover-scale:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease-in-out;
}

/* Loading spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12px;
    }
    
    .container {
        max-width: none !important;
    }
}

/* Responsive table */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem;
    }
}

/* Custom form styles */
.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

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

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

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

/* Card styles */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.card-body {
    padding: 1.5rem;
}

/* Stats card animation */
.stats-card {
    transition: transform 0.2s ease-in-out;
}

.stats-card:hover {
    transform: translateY(-2px);
}

/* Navigation active state */
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 0.5rem;
    width: 80%;
    max-width: 500px;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

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

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    text-decoration: none;
    color: #374151;
    transition: all 0.2s ease-in-out;
}

.pagination a:hover {
    background-color: #f3f4f6;
}

.pagination .active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Search highlight */
.search-highlight {
    background-color: #fef3c7;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, transparent 63%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
}

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

/* Error states */
.error-message {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.error-message h4 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

/* Success states */
.success-message {
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.success-message h4 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #374151;
}

/* Responsive utilities */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .flex-col-mobile {
        flex-direction: column;
    }
    
    .text-sm-mobile {
        font-size: 0.875rem;
    }
}

/* Focus states for accessibility */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-gray-50 {
        background-color: #ffffff;
    }
    
    .text-gray-600 {
        color: #000000;
    }
    
    .border-gray-300 {
        border-color: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
