/* ============================================
   InfoTech Técnico PWA - Stylesheet
   ============================================ */

:root {
    --primary: #5b21b6;
    --primary-light: #7c3aed;
    --primary-dark: #4c1d95;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #252542;
    --bg-input: #1e1e38;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    
    --border-color: #3a3a5c;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
}

input, textarea, select {
    user-select: text;
    -webkit-user-select: text;
}

/* ============================================
   Splash Screen
   ============================================ */

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

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

.splash-logo {
    margin-bottom: 30px;
}

.splash-logo .logo-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 15px;
}

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

.splash-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* ============================================
   App Container
   ============================================ */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

/* ============================================
   Header
   ============================================ */

.app-header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

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

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
}

.header-icon {
    font-size: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-btn {
    background: var(--bg-card);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.header-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Main Content
   ============================================ */

.app-main {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
}

.screen {
    display: none;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.screen.active {
    display: block;
}

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

.screen-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.back-btn {
    background: var(--bg-card);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.back-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Login Screen
   ============================================ */

.login-container {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 140px);
}

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

.login-logo {
    font-size: 4rem;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
}

.login-form {
    flex: 1;
}

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

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 15px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 42px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 10px 16px;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

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

.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Home Screen
   ============================================ */

.home-container {
    padding: 0;
}

.welcome-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.welcome-greeting {
    font-size: 0.9rem;
    opacity: 0.8;
    display: block;
}

.welcome-name {
    font-size: 1.4rem;
    font-weight: 700;
    display: block;
    margin-top: 5px;
}

.welcome-avatar {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.stat-card:active {
    transform: scale(0.98);
}

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

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

.stat-hoje {
    border-color: var(--secondary);
}

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

.stat-icon {
    font-size: 1.8rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Section Title */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.ver-todos {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ============================================
   Chamado Card
   ============================================ */

.chamado-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--primary);
}

.chamado-card:active {
    transform: scale(0.98);
}

.chamado-card.urgente {
    border-color: var(--danger);
}

.chamado-card.alta {
    border-color: var(--warning);
}

.chamado-card.media {
    border-color: var(--info);
}

.chamado-card.baixa {
    border-color: var(--text-muted);
}

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

.chamado-id {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chamado-titulo {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 4px;
}

.chamado-badges {
    display: flex;
    gap: 6px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-urgente { background: #ef444420; color: var(--danger); }
.badge-alta { background: #f59e0b20; color: var(--warning); }
.badge-media { background: #3b82f620; color: var(--info); }
.badge-baixa { background: #6b6b8020; color: var(--text-muted); }

.badge-aberto { background: #3b82f620; color: var(--info); }
.badge-em_andamento { background: #f59e0b20; color: var(--warning); }
.badge-aguardando { background: #7c3aed20; color: var(--primary-light); }
.badge-resolvido { background: #10b98120; color: var(--success); }

.chamado-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.chamado-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chamado-actions {
    display: flex;
    gap: 10px;
}

/* ============================================
   Chamado Detalhe
   ============================================ */

.chamado-detalhe-container {
    padding: 0;
}

.detalhe-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 15px;
}

.detalhe-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detalhe-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.detalhe-row:last-child {
    border-bottom: none;
}

.detalhe-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detalhe-value {
    font-weight: 600;
    text-align: right;
}

.detalhe-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* ============================================
   Fotos Grid
   ============================================ */

.fotos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.foto-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.foto-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.foto-item .remove-foto {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
}

.foto-add-btn {
    aspect-ratio: 1;
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.foto-add-btn span:first-child {
    font-size: 1.5rem;
}

.foto-add-btn:active {
    border-color: var(--primary);
}

/* ============================================
   Assinatura
   ============================================ */

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

#canvas-assinatura {
    background: white;
    border-radius: var(--radius-sm);
    touch-action: none;
    margin-bottom: 10px;
}

/* ============================================
   Filter Buttons
   ============================================ */

.chamados-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.filter-btn {
    padding: 10px 18px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ============================================
   Loading
   ============================================ */

.loading-placeholder {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

/* ============================================
   Bottom Navigation
   ============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
}

.nav-item {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.nav-item.active {
    color: var(--primary-light);
}

.nav-icon {
    font-size: 1.4rem;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: 20%;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
}

/* ============================================
   Toast
   ============================================ */

.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    min-width: 280px;
    max-width: 90vw;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

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

/* ============================================
   Modal
   ============================================ */

.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 25px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

/* ============================================
   Perfil
   ============================================ */

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

.perfil-avatar {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 3rem;
}

.perfil-info {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.perfil-info p {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.perfil-info p:last-child {
    border-bottom: none;
}

.perfil-info strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.perfil-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.perfil-stat {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
}

.perfil-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-light);
    display: block;
}

.perfil-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.perfil-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================
   Mapa
   ============================================ */

.mapa-container {
    height: calc(100vh - 200px);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.mapa-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* ============================================
   Utilities
   ============================================ */

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

/* ============================================
   Indicador Offline
   ============================================ */

.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #000;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.visible {
    transform: translateY(0);
}

.offline-indicator .offline-icon {
    font-size: 1rem;
}

/* Ajustar app quando offline */
body.is-offline .app-header {
    margin-top: 36px;
}

body.is-offline .splash-screen {
    padding-top: 36px;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 400px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    animation: toastIn 0.3s ease forwards;
    width: 100%;
    max-width: 100%;
    pointer-events: auto;
    pointer-events: auto;
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    to {
        transform: translateY(100px);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

.toast.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast.toast-info {
    border-left: 4px solid var(--info);
}

/* ============================================
   Sync Status Badge
   ============================================ */

.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sync-badge.syncing {
    color: var(--info);
}

.sync-badge.synced {
    color: var(--success);
}

.sync-badge.pending {
    color: var(--warning);
}

.sync-badge .sync-icon {
    animation: none;
}

.sync-badge.syncing .sync-icon {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   Offline Data Indicator
   ============================================ */

.offline-data-notice {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 10px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--warning);
}

.offline-data-notice .notice-icon {
    font-size: 1.1rem;
}


