/* Estilo Global - rastreiaWhats */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --sidebar-width: 280px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Layout Principal */
.layout-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #19136b 0%, var(--primary-dark) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-menu {
    padding: 1rem 0;
}

.sidebar-item {
    display: block;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 2rem;
}

.sidebar-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 4px solid white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: var(--dark-color);
}

.user-role {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Content Area */
.content {
    flex: 1;
    padding: 2rem;
}

/* Auth */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.auth-header p {
    margin-top: 0.25rem;
    color: var(--secondary-color);
}

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    min-width: 180px;
    overflow: hidden;
    z-index: 2000;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--dark-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: #f8fafc;
}

/* Notifications */
.notification {
    position: fixed;
    right: 20px;
    top: 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    padding: 0.875rem 1rem;
    z-index: 5000;
    min-width: 280px;
}

.notification-content {
    display: flex;
    gap: 0.625rem;
    align-items: center;
}

.notification-success {
    border-left: 5px solid var(--success-color);
}

.notification-error {
    border-left: 5px solid var(--danger-color);
}

.notification.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    z-index: 3000;
    padding: 1.5rem;
}

.modal-close-fixed {
    position: fixed;
    top: calc(3vh + 1rem);
    right: calc(50% - 360px + 1rem);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    font-size: 1.25rem;
    z-index: 3001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    margin: 3vh auto;
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    font-size: 1.25rem;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 1.25rem;
    flex: 1;
}

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

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-row .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .col-md-6 {
    grid-column: span 1;
}

.form-row .col-md-4 {
    grid-column: span 1;
}

.form-row.col-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* CORREÇÃO: Remover grid que está quebrando as colunas do Bootstrap */
.row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-right: -15px !important;
    margin-left: -15px !important;
}

.col-lg-4, .col-lg-3, .col-lg-6, .col-md-6 {
    position: relative !important;
    width: 100% !important;
    padding-right: 15px !important;
    padding-left: 15px !important;
    flex: 0 0 auto !important;
}

.col-lg-4 {
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
}

.col-lg-3 {
    flex: 0 0 25% !important;
    max-width: 25% !important;
}

.col-lg-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
}

/* LIMITAR ALTURA DOS CARDS DO DASHBOARD */
.dashboard-card {
    max-height: 350px !important;
    min-height: 300px !important;
    height: 350px !important;
}

.dashboard-card .card-body {
    height: calc(100% - 1px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 1.5rem !important;
}

.dashboard-card i.fa-3x {
    margin-bottom: 1rem !important;
}

.dashboard-card h3 {
    margin-bottom: 0.5rem !important;
}

@media (max-width: 992px) {
    .col-lg-4, .col-lg-3, .col-lg-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-row.col-3 {
        grid-template-columns: 1fr;
    }
    
    .col-lg-4, .col-lg-3, .col-lg-6, .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .dashboard-card {
        height: 300px !important;
        min-height: 250px !important;
    }
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content {
        padding: 1rem;
    }
    
    .header {
        padding: 0 1rem;
    }
}

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

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

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
