/* =====================================
   PORTAL DO CLIENTE - ESTILOS
   Sistema de Gestão AT - 3R Network
   ===================================== */

/* Reset e variáveis */
:root {
    --color-primary: #d71920;
    --color-primary-dark: #a01419;
    --color-secondary: #667eea;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    --color-dark: #1a202c;
    --color-gray: #718096;
    --color-light: #f7fafc;
    --color-border: #e2e8f0;
}

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

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

/* =====================================
   HEADER
   ===================================== */

.portal-header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo img {
    height: 48px;
    object-fit: contain;
}

.header-logo h1 {
    font-size: 20px;
    color: var(--color-dark);
    margin: 0;
}

.header-logo span {
    font-size: 14px;
    color: var(--color-gray);
    display: block;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-dark);
    display: block;
}

.user-cnpj {
    font-size: 12px;
    color: var(--color-gray);
}

.btn-logout {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

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

/* =====================================
   CONTAINER
   ===================================== */

.portal-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* =====================================
   TABS
   ===================================== */

.portal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--color-border);
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-gray);
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--color-primary);
}

.tab-btn.active {
    color: var(--color-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
}

.tab-badge {
    background: var(--color-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* =====================================
   CARDS
   ===================================== */

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

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--color-primary);
    transition: all 0.3s;
}

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

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-card-title {
    font-size: 14px;
    color: var(--color-gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 20px;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-dark);
}

.stat-card-subtitle {
    font-size: 13px;
    color: var(--color-gray);
    margin-top: 4px;
}

/* Cores dos cards */
.stat-card.primary {
    border-left-color: var(--color-primary);
}

.stat-card.primary .stat-card-icon {
    background: rgba(215, 25, 32, 0.1);
    color: var(--color-primary);
}

.stat-card.success {
    border-left-color: var(--color-success);
}

.stat-card.success .stat-card-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.stat-card.warning {
    border-left-color: var(--color-warning);
}

.stat-card.warning .stat-card-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.stat-card.info {
    border-left-color: var(--color-info);
}

.stat-card.info .stat-card-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-info);
}

/* =====================================
   TABLE
   ===================================== */

.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.table-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-title i {
    color: var(--color-primary);
}

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

.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 40px 10px 16px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    width: 300px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.1);
}

.search-box i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gray);
}

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

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

thead {
    background: var(--color-light);
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

tbody td {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    font-size: 14px;
}

tbody tr {
    transition: all 0.2s;
}

tbody tr:hover {
    background: var(--color-light);
}

/* =====================================
   BADGES
   ===================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge i {
    font-size: 10px;
}

.badge.status-entrada {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.badge.status-analise,
.badge.status-avaliacao {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

.badge.status-orcamento {
    background: rgba(168, 85, 247, 0.1);
    color: #6b21a8;
}

.badge.status-aprovado {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.badge.status-reparo {
    background: rgba(99, 102, 241, 0.1);
    color: #3730a3;
}

.badge.status-concluido {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.badge.status-cancelado,
.badge.status-reprovado {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

/* =====================================
   BUTTONS
   ===================================== */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(215, 25, 32, 0.3);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--color-dark);
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

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

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =====================================
   BOLETOS
   ===================================== */

.boletos-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.boleto-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.boleto-card:hover {
    border-color: #d71920;
    box-shadow: 0 4px 12px rgba(215, 25, 32, 0.1);
    transform: translateY(-2px);
}

.boleto-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.boleto-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #d71920 0%, #a01419 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.boleto-icon i {
    font-size: 28px;
    color: white;
}

.boleto-details h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 8px 0;
}

.boleto-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #718096;
}

.boleto-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.boleto-meta i {
    color: #d71920;
}

.boleto-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title i {
    color: var(--color-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: none;
    background: var(--color-light);
    color: var(--color-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--color-danger);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* =====================================
   EQUIPMENT CARD
   ===================================== */

.equipment-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--color-border);
    transition: all 0.3s;
    cursor: pointer;
}

.equipment-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.equipment-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.equipment-info h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 4px;
}

.equipment-info p {
    font-size: 13px;
    color: var(--color-gray);
}

.equipment-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.equipment-detail {
    display: flex;
    flex-direction: column;
}

.equipment-detail-label {
    font-size: 11px;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.equipment-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-dark);
}

/* =====================================
   TIMELINE
   ===================================== */

.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -28px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--color-border);
}

.timeline-content {
    background: var(--color-light);
    padding: 12px 16px;
    border-radius: 8px;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-dark);
}

.timeline-date {
    font-size: 12px;
    color: var(--color-gray);
}

.timeline-text {
    font-size: 13px;
    color: var(--color-gray);
    line-height: 1.5;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.empty-state i {
    font-size: 64px;
    color: var(--color-border);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--color-dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--color-gray);
    max-width: 400px;
    margin: 0 auto;
}

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

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .header-logo {
        flex-direction: column;
        text-align: center;
    }
    
    .user-info {
        text-align: center;
    }
    
    .portal-tabs {
        flex-direction: column;
        border-bottom: none;
    }
    
    .tab-btn {
        border-left: 3px solid transparent;
        padding: 12px 16px;
    }
    
    .tab-btn.active::after {
        display: none;
    }
    
    .tab-btn.active {
        border-left-color: var(--color-primary);
        background: rgba(215, 25, 32, 0.05);
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .table-actions {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .table-wrapper {
        overflow-x: scroll;
    }
    
    table {
        min-width: 600px;
    }
    
    .modal {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
}

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

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    flex-direction: column;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 14px;
    color: var(--color-gray);
    font-weight: 600;
}

/* =====================================
   ALERT
   ===================================== */

.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.alert i {
    font-size: 18px;
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.alert.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert.info {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
