/**
 * Sistema Gestão CV Sul - Estilos Globais
 * Paleta de Cores:
 * - #f6f6f6 (Fundo claro)
 * - #1b3a68 (Azul principal)
 * - #76c59d (Verde sucesso)
 * - #7e8fa7 (Cinza médio)
 * - #aaaaaa (Cinza claro)
 */

:root {
    --color-bg-light: #f6f6f6;
    --color-primary: #1b3a68;
    --color-success: #76c59d;
    --color-secondary: #7e8fa7;
    --color-muted: #aaaaaa;
    --color-white: #ffffff;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg-light);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
}

.login-container .card {
    max-width: 450px;
    width: 100%;
    border: none;
    border-radius: 15px;
}

/* PWA Install Button */
#install-pwa-container {
    animation: slideIn 0.3s ease-out;
}

#install-pwa-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    box-shadow: 0 4px 6px rgba(40, 167, 69, 0.3);
    font-weight: 600;
    transition: all 0.3s ease;
}

#install-pwa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
}

#install-pwa-btn:active {
    transform: translateY(0);
}

#install-pwa-btn i {
    animation: bounce 2s infinite;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Navigation */
.navbar {
    background-color: var(--color-primary) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

/* Custom Button Styles */
.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: #132847;
    border-color: #132847;
}

.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.btn-success:hover {
    background-color: #5fa982;
    border-color: #5fa982;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background-color: var(--color-primary);
    color: white;
    border-radius: 10px 10px 0 0 !important;
    padding: 15px 20px;
    font-weight: 600;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(27, 58, 104, 0.15);
}

.form-control[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Tables */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--color-primary);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 12px;
}

.table tbody tr:hover {
    background-color: rgba(27, 58, 104, 0.05);
}

/* Status Badges */
.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
}

.status-pendente {
    background-color: var(--color-warning);
    color: #000;
}

.status-andamento {
    background-color: #0dcaf0;
    color: #000;
}

.status-executada {
    background-color: var(--color-success);
    color: white;
}

.status-cancelada {
    background-color: var(--color-danger);
    color: white;
}

/* Offline Indicator */
#offline-indicator {
    position: fixed;
    top: 56px; /* Altura da navbar */
    left: 0;
    right: 0;
    z-index: 1030;
    border-radius: 0;
    margin: 0;
    padding: 8px 15px;
    font-size: 0.9rem;
    text-align: center;
}

/* Compensar altura do indicador offline */
body.offline-mode #content {
    padding-top: 50px;
}

/* Container principal com padding para navbar + offline */
#main-content {
    padding-bottom: 80px; /* Espaço para botões fixos na parte inferior */
}

/* Ajuste mobile para evitar sobreposição */
@media (max-width: 768px) {
    body.offline-mode #content {
        padding-top: 60px;
    }
    
    #main-content {
        padding-bottom: 120px; /* Mais espaço em mobile */
    }
    
    .fixed-bottom-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }
}

/* Sync Badge */
#pending-sync-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

/* Image Preview */
.image-preview {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    border: 2px solid var(--color-muted);
}

.image-preview-container {
    position: relative;
    display: inline-block;
}

.image-preview-container .btn-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* Signature Canvas */
.signature-canvas {
    border: 2px solid var(--color-muted);
    border-radius: 8px;
    cursor: crosshair;
    background-color: white;
    touch-action: none;
}

.signature-container {
    position: relative;
}

.signature-controls {
    margin-top: 10px;
}

/* List Items */
.list-group-item {
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.list-group-item:hover {
    border-left-color: var(--color-primary);
    background-color: rgba(27, 58, 104, 0.03);
}

.list-group-item.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
}

.action-buttons .btn {
    padding: 4px 10px;
    font-size: 0.875rem;
}

/* Material Table */
.material-table {
    margin-top: 15px;
}

.material-table th {
    background-color: var(--color-secondary);
    color: white;
    font-size: 0.85rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--color-muted);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Utility Classes */
.text-primary-custom {
    color: var(--color-primary) !important;
}

.bg-primary-custom {
    background-color: var(--color-primary) !important;
}

.text-success-custom {
    color: var(--color-success) !important;
}

.bg-success-custom {
    background-color: var(--color-success) !important;
}

/* Full Screen Signature Mode */
.signature-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 9998;
    display: flex;
    flex-direction: column;
}

.signature-fullscreen .signature-canvas {
    flex: 1;
    width: 100%;
    border: none;
    border-radius: 0;
}

.signature-fullscreen .signature-controls {
    padding: 15px;
    background-color: var(--color-bg-light);
    border-top: 1px solid var(--color-muted);
}
