/* ==================== VARIABLES ==================== */
:root {
    --white: #ffffff;
    --gray-light: #b1b1ab;
    --gray-medium: #e5e5e5;
    --gray-dark: #4e4d4d;
    --yellow: #ffec00;
    --blue: #2f358b;
    --green: #009145;
    --red: #e74c3c;
    --orange: #f39c12;
    --black: #1a1a1a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--gray-dark);
    line-height: 1.7;
    background: #f8f9fa;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    line-height: 1.2;
    color: var(--blue);
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

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

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

.loading-overlay p {
    margin-top: 20px;
    color: var(--gray-dark);
    font-size: 16px;
}

/* ==================== HEADER ==================== */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.nav {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 40px;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-container img {
    height: 45px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-name {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    color: var(--blue);
    font-size: 15px;
}

.btn-logout {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    padding: 8px 20px;
    background: transparent;
    color: var(--red);
    border: 2px solid var(--red);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.btn-logout:hover {
    background: var(--red);
    color: var(--white);
}

/* ==================== BUTTONS ==================== */
.btn {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    text-align: center;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-primary {
    background: var(--green);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 145, 69, 0.3);
}

.btn-primary:hover {
    background: #007a38;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 145, 69, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--blue);
    border: 2px solid var(--blue);
}

.btn-outline:hover {
    background: var(--blue);
    color: var(--white);
    transform: translateY(-2px);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--blue);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
}

.btn-back:hover {
    background: var(--gray-medium);
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 100px 40px 60px;
}

/* ==================== AUTH SECTION ==================== */
.auth-section {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 120px 20px 40px; /* Top padding to account for fixed header */
    background: linear-gradient(135deg, var(--blue) 0%, #1a2055 100%);
    overflow-y: auto;
    overflow-x: hidden;
}

.auth-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.auth-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 35px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 100%;
}

.auth-logo {
    width: 180px;
    margin-bottom: 30px;
}

.auth-card h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--blue);
}

.auth-subtitle {
    color: var(--gray-dark);
    margin-bottom: 30px;
    font-size: 15px;
}

.auth-form {
    text-align: left;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-dark);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-medium);
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    transition: var(--transition);
    color: var(--gray-dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0, 145, 69, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--gray-light);
    font-size: 13px;
}

/* Custom file input styling */
.custom-file-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.file-input-hidden {
    display: none;
}

.btn-escolher-arquivos {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-escolher-arquivos:hover {
    background: #1f2570;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(47, 53, 139, 0.3);
}

.file-name-display {
    color: var(--gray-dark);
    font-size: 14px;
    font-style: italic;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-links {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-links a {
    color: var(--blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.auth-links a:hover {
    color: var(--green);
}

/* ==================== DASHBOARD ==================== */
.dashboard-section {
    min-height: 100vh;
    background: #f8f9fa;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.user-info h1 {
    font-size: 32px;
    margin-bottom: 5px;
}

.user-info p {
    color: var(--gray-light);
    font-size: 15px;
}

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

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 30px;
    height: 30px;
}

.stat-icon.blue {
    background: rgba(47, 53, 139, 0.1);
    color: var(--blue);
}

.stat-icon.green {
    background: rgba(0, 145, 69, 0.1);
    color: var(--green);
}

.stat-icon.yellow {
    background: rgba(255, 236, 0, 0.2);
    color: #d4a017;
}

.stat-content h3 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--gray-dark);
}

.stat-content p {
    color: var(--gray-light);
    font-size: 14px;
    font-weight: 600;
}

/* ==================== TICKETS SECTION ==================== */
.tickets-section {
    background: var(--white);
    border-radius: 12px;
    padding: 35px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h2 {
    font-size: 24px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--gray-dark);
    border: 2px solid var(--gray-medium);
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--green);
    color: var(--green);
}

.filter-btn.active {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}

.tickets-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.no-tickets {
    text-align: center;
    padding: 60px 20px;
    color: #495057;
    font-size: 18px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    width: 100%;
}

.ticket-card {
    background: var(--white);
    border: 2px solid var(--gray-medium);
    border-radius: 12px;
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.ticket-card:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

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

.ticket-protocol {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    color: var(--blue);
    font-size: 16px;
}

.ticket-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-analise {
    background: rgba(243, 156, 18, 0.15);
    color: var(--orange);
}

.status-atendimento {
    background: rgba(47, 53, 139, 0.15);
    color: var(--blue);
}

.status-aguardando {
    background: rgba(231, 76, 60, 0.15);
    color: var(--red);
}

.status-concluido {
    background: rgba(0, 145, 69, 0.15);
    color: var(--green);
}

.ticket-card-body {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.ticket-card-body h4 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--gray-dark);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.ticket-company {
    color: var(--gray-light);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.ticket-description {
    color: var(--gray-dark);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.ticket-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-medium);
}

.ticket-date {
    color: var(--gray-light);
    font-size: 13px;
}

.btn-view-ticket {
    padding: 6px 16px;
    background: var(--green);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
}

.btn-view-ticket:hover {
    background: #007a38;
}

/* ==================== FORM SECTION ==================== */
.form-section {
    min-height: 100vh;
    background: #f8f9fa;
}

.form-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 35px;
}

.form-header h1 {
    font-size: 28px;
}

.ticket-form {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-sm);
}

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

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: flex-end;
}

.files-preview {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-medium);
    border-radius: 8px;
}

.file-name {
    font-weight: 600;
    color: var(--gray-dark);
    font-size: 14px;
}

.file-size {
    color: var(--gray-light);
    font-size: 13px;
}

.btn-remove-file {
    background: var(--red);
    color: var(--white);
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-remove-file:hover {
    background: #c0392b;
}

/* ==================== TICKET VIEW ==================== */
.ticket-view-section {
    min-height: 100vh;
    background: #f8f9fa;
}

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

.ticket-header-info h1 {
    font-size: 28px;
}

.ticket-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
    align-items: start;
}

.ticket-details {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
}

.ticket-details h2 {
    font-size: 20px;
    margin-bottom: 25px;
}

.detail-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-medium);
}

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

.detail-item.full {
    grid-column: 1 / -1;
}

.detail-label {
    display: block;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 8px;
    font-size: 14px;
}

.detail-value {
    color: var(--gray-dark);
    font-size: 15px;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.detail-description {
    color: var(--gray-dark);
    line-height: 1.7;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.detail-files {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--gray-medium);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.detail-file-item:hover {
    background: #d5d5d5;
}

/* ==================== CHAT ==================== */
.ticket-chat {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 700px;
}

.ticket-chat h2 {
    font-size: 20px;
    margin-bottom: 25px;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.message-item {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 12px;
    max-width: 85%;
}

.message-user {
    background: var(--green);
    color: var(--white);
    margin-left: auto;
}

.message-tecnico {
    background: var(--white);
    border: 2px solid var(--gray-medium);
    color: var(--gray-dark);
}

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

.message-header strong {
    font-weight: 700;
    font-size: 14px;
}

.message-date {
    font-size: 12px;
    opacity: 0.8;
}

.message-text {
    line-height: 1.6;
    font-size: 14px;
}

.message-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-form textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--gray-medium);
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    resize: vertical;
    transition: var(--transition);
}

.message-form textarea:focus {
    outline: none;
    border-color: var(--green);
}

.message-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-attach {
    padding: 10px;
    background: transparent;
    color: var(--gray-dark);
    border: 2px solid var(--gray-medium);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-attach:hover {
    border-color: var(--green);
    color: var(--green);
}

.message-file-preview {
    padding: 10px;
    background: var(--gray-medium);
    border-radius: 8px;
    font-size: 13px;
    color: var(--gray-dark);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 968px) {
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .ticket-chat {
        height: 600px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 90px 20px 40px;
    }
    
    .nav {
        padding: 10px 20px;
        flex-wrap: wrap;
    }
    
    .logo-container img {
        height: 40px;
        max-width: 120px;
    }
    
    .nav-user {
        gap: 15px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .btn-logout {
        padding: 6px 16px;
        font-size: 13px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .user-info h1 {
        font-size: 26px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .stat-card {
        padding: 25px 20px;
    }
    
    .tickets-list {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: flex-start;
    }
    
    .form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .auth-section {
        padding: 90px 15px 30px;
    }
    
    .auth-card {
        padding: 35px 25px;
    }
    
    .auth-logo {
        width: 140px;
        margin-bottom: 20px;
    }
    
    .auth-card h1 {
        font-size: 24px;
    }
    
    .auth-subtitle {
        font-size: 14px;
        margin-bottom: 25px;
    }
    
    .ticket-form {
        padding: 30px 20px;
    }
    
    .tickets-section {
        padding: 25px 20px;
    }
    
    .ticket-details {
        padding: 25px 20px;
    }
    
    .ticket-chat {
        padding: 25px 20px;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 80px 15px 30px;
    }
    
    .nav {
        padding: 8px 15px;
    }
    
    .logo-container img {
        height: 30px;
    }
    
    .user-info h1 {
        font-size: 22px;
    }
    
    .user-info p {
        font-size: 14px;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
    
    .auth-section {
        padding: 80px 12px 25px;
        min-height: 100vh;
        min-height: 100dvh;
        align-items: center;
    }
    
    .auth-container {
        max-width: 100%;
    }
    
    .auth-card {
        padding: 30px 20px;
        border-radius: 12px;
    }
    
    .auth-card h1 {
        font-size: 22px;
        margin-bottom: 10px;
    }
    
    .auth-logo {
        width: 130px;
        margin-bottom: 20px;
    }
    
    .auth-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-header h1 {
        font-size: 20px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    .stat-card {
        padding: 20px;
        gap: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
    }
    
    .stat-icon svg {
        width: 25px;
        height: 25px;
    }
    
    .stat-content h3 {
        font-size: 30px;
    }
    
    .stat-content p {
        font-size: 13px;
    }
    
    .ticket-card {
        padding: 18px;
    }
    
    .ticket-form,
    .tickets-section,
    .ticket-details,
    .ticket-chat {
        padding: 20px 15px;
    }
    
    .message-item {
        max-width: 95%;
        padding: 14px;
    }
    
    .filter-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Extra small devices (landscape phones, very small screens) */
@media (max-width: 360px) {
    .auth-section {
        padding: 75px 10px 20px;
    }
    
    .auth-card {
        padding: 25px 15px;
    }
    
    .auth-logo {
        width: 110px;
        margin-bottom: 15px;
    }
    
    .auth-card h1 {
        font-size: 20px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 11px 12px;
        font-size: 14px;
    }
}
