/* ============================================
   SISTEMA DE CONTROLO DE HORAS - BOMBEIROS
   Tema: Profissional com cores de bombeiros
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #DC143C;      /* Vermelho bombeiros */
    --primary-dark: #B22222; /* Vermelho escuro */
    --primary-light: #FF6B6B; /* Vermelho claro */
    --secondary: #1a1a1a;    /* Preto */
    --accent: #FFD700;       /* Dourado */
    --light: #f8f9fa;        /* Cinzento claro */
    --border: #e0e0e0;       /* Cinzento borda */
    --text: #333;            /* Texto escuro */
    --text-light: #666;      /* Texto claro */
    --success: #28a745;      /* Verde sucesso */
    --danger: #dc3545;       /* Vermelho perigo */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-buttons {
    display: flex;
    gap: 1rem;
}

.header-buttons a {
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid white;
    color: white;
    cursor: pointer;
}

.header-buttons a:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-2px);
}

.btn-admin {
    background: rgba(255, 255, 255, 0.2);
}

.btn-bombeiro {
    background: rgba(255, 255, 255, 0.2);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */

.painel-container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    padding: 2rem;
}

/* ============================================
   MENSAGENS
   ============================================ */

.mensagem-sucesso {
    background: linear-gradient(135deg, var(--success) 0%, #20c997 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SECÇÕES DE INFORMAÇÃO
   ============================================ */

section {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

section:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

section h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

section h3 {
    color: var(--primary-dark);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

/* ============================================
   INFORMAÇÕES DO BOMBEIRO
   ============================================ */

.info-bombeiro {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.info-bombeiro h2 {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.info-bombeiro p {
    margin: 0.8rem 0;
    font-size: 1.05rem;
}

.info-bombeiro strong {
    color: var(--accent);
}

.info-bombeiro-admin {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.info-bombeiro-admin h3 {
    color: white;
    margin-top: 0;
}

.info-bombeiro-admin p {
    margin: 0.5rem 0;
}

.info-bombeiro-admin strong {
    color: var(--accent);
}

/* ============================================
   ANTIGUIDADE
   ============================================ */

.antiguidade-compacta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.antiguidade-esquerda,
.antiguidade-direita {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.antiguidade-esquerda h3,
.antiguidade-direita h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.antiguidade-resumo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.resumo-item {
    background: linear-gradient(135deg, var(--light) 0%, #f0f0f0 100%);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.resumo-label {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.resumo-valor {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.medalhas-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.medalha-item {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent) 0%, #FFC700 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
    font-weight: 700;
    color: var(--secondary);
}

.proxima-medalha {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ============================================
   RESUMO DE HORAS
   ============================================ */

.resumo-horas {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.resumo-horas h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 1rem;
}

.horas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.hora-item {
    background: linear-gradient(135deg, var(--light) 0%, #f0f0f0 100%);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    cursor: default;
}

.hora-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.hora-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

.hora-valor {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.hora-item[style*="background: linear-gradient"] .hora-valor {
    color: white;
}

/* ============================================
   TABELAS
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
}

table tbody tr {
    transition: background 0.2s ease;
}

table tbody tr:hover {
    background: var(--light);
}

table tbody tr:nth-child(even) {
    background: rgba(220, 20, 60, 0.02);
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.form-admin,
.form-filtro {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-section {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary);
}

.form-section h3 {
    margin-top: 0;
}

/* ============================================
   BOTÕES
   ============================================ */

.btn-submit {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.9rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(220, 20, 60, 0.2);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.3);
}

.btn-submit:active {
    transform: translateY(0);
}

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.tab-button {
    padding: 0.8rem 1.5rem;
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.tab-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(220, 20, 60, 0.2);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   FILTRO
   ============================================ */

.filtro-bombeiro {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary);
}

.form-filtro {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-filtro label {
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    font-size: 0.9rem;
}

.form-filtro select {
    flex: 1;
    min-width: 250px;
}

/* ============================================
   REGISTOS E HISTÓRICO
   ============================================ */

.registos-horas,
.historico-horas {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.registos-horas h2,
.historico-horas h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 1rem;
}

.sem-registos {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
    background: var(--light);
    border-radius: 6px;
    margin-top: 1rem;
}

/* ============================================
   RESPONSIVO
   ============================================ */

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .header-buttons {
        justify-content: center;
        width: 100%;
    }

    main {
        padding: 1rem;
    }

    section {
        padding: 1.5rem;
    }

    .horas-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .antiguidade-compacta {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-button {
        width: 100%;
        text-align: center;
    }

    table {
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 0.7rem 0.5rem;
    }

    .form-filtro {
        flex-direction: column;
    }

    .form-filtro select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.2rem;
    }

    .header-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-buttons a {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    section {
        padding: 1rem;
    }

    .horas-grid {
        grid-template-columns: 1fr;
    }

    .resumo-item {
        grid-column: 1 / -1;
    }

    table {
        font-size: 0.8rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }
}

/* ============================================
   ANIMAÇÕES E EFEITOS
   ============================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}