/* ==========================================
   AVADA CRM - STYLING
   ========================================== */

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

html,
body {
    overflow-x: hidden;
    /* Previne scroll horizontal */
    max-width: 100vw;
    /* Limita a 100% da viewport width */
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
}

/* ==========================================
   LOGIN PAGE
   ========================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 10px;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.login-subtitle {
    color: #718096;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* ==========================================
   DASHBOARD LAYOUT
   ========================================== */

.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #2d3748;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

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

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.sidebar-user {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar-user-role {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 3px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e2e8f0;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.menu-item.active {
    background: #667eea;
    color: white;
    border-left: 4px solid #fff;
}

.menu-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

.main-content {
    flex: 1;
    margin-left: 260px;
    background: #f5f7fa;
}

.topbar {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
}

.content-area {
    padding: 30px;
}

/* ==========================================
   CARDS & STATS
   ========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

.stat-icon.blue {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.stat-icon.green {
    background: rgba(72, 187, 120, 0.1);
    color: #48bb78;
}

.stat-icon.purple {
    background: rgba(159, 122, 234, 0.1);
    color: #9f7aea;
}

.stat-icon.orange {
    background: rgba(237, 137, 54, 0.1);
    color: #ed8936;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-label {
    color: #718096;
    font-size: 0.9rem;
}

/* ==========================================
   TABLES
   ========================================== */

.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

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

.table-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #48bb78;
    color: white;
}

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

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

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

.data-table th {
    background: #f7fafc;
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    color: #2d3748;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-warning {
    background: #feebc8;
    color: #7c2d12;
}

.badge-info {
    background: #bee3f8;
    color: #2c5282;
}

.badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

/* ==========================================
   MODALS
   ========================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f7fafc;
    color: #2d3748;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================================
   SYSTEM INFO PANEL
   ========================================== */

.info-grid {
    display: grid;
    gap: 20px;
}

.info-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.info-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card-icon {
    font-size: 1.5rem;
}

.user-list {
    list-style: none;
}

.user-item {
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.user-item:last-child {
    border-bottom: none;
}

.user-item-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.user-item-email {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.user-item-role {
    font-size: 0.85rem;
    display: inline-block;
}

.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
    border-left: 4px solid #3182ce;
}

.alert-warning {
    background: #feebc8;
    color: #7c2d12;
    border-left: 4px solid #dd6b20;
}

/* ==========================================
   EMPTY STATE
   ========================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state-icon {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 20px;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 10px;
}

/* ==========================================
   LOADING STATE
   ========================================== */

.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 0.8s linear infinite;
}

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

/* ==========================================
   RESPONSIVE
   ========================================== */

/* Tablets e telas médias */
@media (max-width: 1024px) {
    .content-area {
        padding: 25px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .content-area {
        padding: 20px;
    }

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

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }
}

/* Telas grandes de PC - Otimização para 100% */
@media (min-width: 1200px) {
    .content-area {
        padding: 30px 40px;
        /* Mais padding horizontal para telas grandes */
        max-width: none;
        /* Remove limitação de largura */
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        /* 4 colunas fixas em telas grandes */
        gap: 24px;
    }

    .table-container {
        width: 100%;
        max-width: none;
    }

    .kanban-board {
        gap: 24px;
    }

    .kanban-column {
        min-width: calc(25% - 18px);
        /* 4 colunas iguais */
    }
}

/* Telas ultra-wide (> 1600px) */
@media (min-width: 1600px) {
    .content-area {
        padding: 40px 60px;
        /* Mais espaço em monitores ultra-wide */
    }

    .stats-grid {
        gap: 30px;
    }

    .kanban-board {
        gap: 30px;
    }
}

/* ==========================================
   UTILITIES
   ========================================== */

.hidden {
    display: none !important;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

/* ==========================================
   ATTACHMENTS
   ========================================== */

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.attachment-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.attachment-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.attachment-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.attachment-details {
    display: flex;
    flex-direction: column;
}

.attachment-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.attachment-meta {
    font-size: 0.8rem;
    color: #718096;
}

.upload-area {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.flex-row {
    display: flex;
    align-items: center;
}