/* Base Template Styles */

:root {
    --primary: #2C5290;
    --primary-dark: #1e3964;
    --primary-fg: #fff;
    --body-bg: rgba(244, 246, 249, 1);
    --body-fg: #333;
    --border-color: #dee2e6;
}

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

html, body {
    height: 100%;
    background: var(--body-bg);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
}

@media (min-width: 481px) and (max-width: 650px) {
    .main-header {
        min-height: 70px;
        padding: 10px 16px;
    }

    .logo-link {
        max-width: 58%;
    }

    .header-logo {
        height: 46px;
        max-width: 100%;
        object-fit: contain;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 12px;
    }

    .user-profile-btn {
        padding: 8px 10px;
    }

    .user-name {
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dropdown-menu {
        min-width: 220px;
    }

    .mobile-menu-toggle {
        padding: 6px 10px;
        font-size: 1.15rem;
    }
}

/* Header */
.main-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 85px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 10px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 30px;
}

.header-logo {
    height: 65px;
    width: auto;
    transition: all 0.3s ease;
    filter: brightness(1.05);
}

.header-logo:hover {
    transform: scale(1.08);
    filter: brightness(1.15);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.user-profile-dropdown {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-fg) !important;
    text-decoration: none !important;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
}

.user-profile-btn:hover,
.user-profile-btn:focus {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--primary-fg) !important;
    text-decoration: none !important;
    transform: translateY(-2px);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.15) 100%);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.user-profile-btn:hover .user-avatar,
.user-profile-btn:focus .user-avatar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.2) 100%);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    animation: slideDown 0.2s ease;
    padding: 8px 0;
    min-width: 260px;
    margin-top: 12px;
}

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

.dropdown-menu .dropdown-header {
    padding: 16px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e9ecef;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.dropdown-menu .dropdown-header strong {
    display: block;
    color: #1e3964;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.dropdown-menu .dropdown-header small {
    display: block;
    color: #6c757d;
    font-size: 0.8rem;
}

.dropdown-divider {
    margin: 8px 0;
    border-color: #e9ecef;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    color: #333;
    font-weight: 500;
}

.dropdown-item:hover {
    background: #eef3fb;
    border-left-color: #2C5290;
    padding-left: calc(16px + 3px);
    color: #2C5290;
}

.dropdown-item i {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #2C5290;
    transition: all 0.2s ease;
}

.dropdown-item:hover i {
    transform: translateX(2px);
    color: #1e3964;
}

.dropdown-item-card .dropdown-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111111;
}

.dropdown-item-card .dropdown-item-icon--muted {
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    color: #4b5563;
}

.dropdown-item-card .dropdown-item-icon--light {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111111;
}

.dropdown-item-card .dropdown-item-icon i {
    color: inherit;
}

.dropdown-item-card:hover .dropdown-item-icon i {
    color: inherit;
    transform: none;
}

.dropdown-item-card .dropdown-item-title {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 600;
}

.dropdown-item-card .dropdown-item-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
}

.dropdown-item.text-danger {
    color: #dc3545 !important;
}

.dropdown-item.text-danger:hover {
    background: #fff5f5;
    border-left-color: #dc3545;
    color: #dc3545 !important;
}

.dropdown-item.text-danger:hover i {
    color: #dc3545;
}

/* Main Content */
.main-container {
    flex: 1;
}

.content-area {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 70px;
    position: relative;
}

.page-header-row {
    margin: 0 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.page-header-content {
    flex: 1;
    min-width: 0;
}

.navigation-container {
    display: flex;
    align-items: center;
    z-index: 5;
    margin-right: 70px;
}

.inline-navigation {
    margin-top: 24px;
    margin-bottom: 28px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 768px) {
    .content-area {
        padding: 0 12px;
    }

    .page-header-row {
        margin-bottom: 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .inline-navigation {
        margin-top: 20px;
        margin-bottom: 24px;
        padding-top: 16px;
    }
}

/* Footer */
.main-footer {
    background: var(--primary);
    color: var(--primary-fg);
    padding: 20px 0;
    margin-top: auto;
    display: flex;
    align-items: center;
    position: sticky;
    bottom: 0;
    z-index: 100;
    justify-content: center;
}

.mobile-menu {
    display: none;
    position: relative;
}

.mobile-menu-toggle {
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 1.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-item-card .dropdown-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #eef3fb, #dce7f8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2C5290;
}

.dropdown-item-card .dropdown-item-title {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 600;
}

.dropdown-item-card .dropdown-item-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
}

.dropdown-item-card .dropdown-item-icon--danger {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: #dc3545;
}

.mobile-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    min-width: 260px;
    z-index: 1200;
    width: min(92vw, 360px);
}

.mobile-menu-panel .accessibility-btn {
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e5e7eb;
}

.mobile-menu-panel .accessibility-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: none;
}

.mobile-menu-panel .accessibility-font-controls {
    background: #f1f5f9;
}

.mobile-menu-panel .font-btn {
    color: #1e293b;
}

.mobile-menu-panel .font-btn:hover {
    background: #e2e8f0;
    transform: none;
}

.mobile-menu-panel .font-divider {
    background-color: #cbd5f5;
}

.mobile-menu-section + .mobile-menu-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.mobile-menu-title {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

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

.mobile-profile {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-profile-name {
    font-weight: 700;
    color: #1e293b;
}

.mobile-profile-email {
    color: #6b7280;
    font-size: 0.9rem;
}

.mobile-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #1e293b;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mobile-menu-link:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    padding: 0 20px;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-info {
    font-size: 0.95rem;
}

.footer-info .separator {
    margin: 0 8px;
}

.footer-user {
    font-size: 0.875rem;
    opacity: 0.9;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

.footer-logo {
    width: auto;
    object-fit: contain;
    object-position: center;
}

.logo-vila-olimpica {
    height: 42px;
}

.logo-gov-paraiba {
    height: 35px;
}

.logo-codata {
    height: 29px;
}

h4.page-title {
    text-align: center;
    color: var(--primary);
    margin: 20px 0;
    font-weight: 600;
}

.container-fluid.min-vh-100 {
    min-height: auto;
}

/* Messages */
.messagelist {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 0 20px;
}

.messages-container {
    margin: 0 0 20px;
}

.alert {
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid transparent;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.alert + .alert {
    margin-top: 10px;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border-color: #86efac;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fcd34d;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

/* Responsive */
@media (max-width: 768px) {
    .content-area {
        padding: 0 15px;
    }

    .main-footer {
        position: static;
        bottom: auto;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .header-accessibility,
    .header-right .dropdown {
        display: none !important;
    }

    .mobile-menu {
        display: block;
    }

    .mobile-menu-panel {
        right: 0;
        left: auto;
    }

    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }

    .footer-left {
        align-items: center;
    }

    .footer-right {
        flex-direction: column;
        justify-content: center;
        width: 100%;
        gap: 15px;
    }

    .user-name {
        display: none;
    }

    .main-header {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: 0 8px;
    }

    .main-header {
        padding: 0 8px;
    }

    .logo-vila-olimpica {
        height: 32px;
    }

    .logo-gov-paraiba {
        height: 28px;
    }

    .logo-codata {
        height: 23px;
    }

    .footer-info,
    .footer-user {
        font-size: 0.8rem;
    }

    .header-logo {
        height: 35px;
    }
}

@media (min-width: 481px) and (max-width: 650px) {
    .main-header {
        min-height: 80px;
        padding: 8px 16px;
        align-items: center;
    }

    .header-content {
        align-items: center;
        flex-wrap: nowrap;
    }

    .header-left {
        display: flex;
        align-items: center;
        flex: 1 1 auto;
    }

    .header-right {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex: 1 1 auto;
        width: auto;
    }

    .mobile-menu {
        display: flex;
        align-items: center;
    }

    .logo-link {
        display: flex;
        align-items: center;
        max-width: 100%;
    }

    .header-logo {
        height: 56px;
        max-width: 100%;
        object-fit: contain;
    }

    .mobile-menu-toggle {
        line-height: 1;
        padding: 6px 10px;
        font-size: 1.15rem;
    }
}
