﻿/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --system-bg-start: #667eea;
    --system-bg-end: #764ba2;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, var(--system-bg-start) 0%, var(--system-bg-end) 100%);
    min-height: 100vh;
}

body.header-stats-hidden .header-stats-left .header-stat,
body.header-stats-hidden .header-stats-right .header-stat {
    visibility: hidden;
    pointer-events: none;
}

.container {
    max-width: min(100%, 1680px);
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.double-y-wordmark {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: white;
    transform-origin: center center;
    animation:
        doubleYEntrance 1.2s ease-out both,
        doubleYFloat 5s ease-in-out 1.2s infinite;
}

.double-y-wordmark::before {
    content: '';
    position: absolute;
    inset: -14px -22px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(102, 126, 234, 0.2) 45%, transparent 72%);
    opacity: 0.55;
    z-index: 0;
    pointer-events: none;
    animation: doubleYGlow 3.5s ease-in-out infinite;
}

.double-y-wordmark::after {
    content: '';
    position: absolute;
    inset: -6px -10px;
    border-radius: 16px;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 70%
    );
    background-size: 220% 100%;
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: doubleYSweep 4.5s ease-in-out 1.5s infinite;
}

.double-y-wordmark .double-y-name,
.double-y-wordmark .double-y-glyph {
    position: relative;
    z-index: 1;
}

.double-y-wordmark .double-y-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.06em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(
        90deg,
        #ffffff 0%,
        #eef1ff 20%,
        #ffffff 40%,
        #ddd6fe 60%,
        #ffffff 80%,
        #eef1ff 100%
    );
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: doubleYShimmer 3.2s linear infinite;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.28));
}

.double-y-wordmark .double-y-glyph {
    width: 1rem;
    height: auto;
    filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(255, 255, 255, 0.55));
    animation: doubleYGlyphPulse 2.8s ease-in-out infinite;
}

.double-y-wordmark .double-y-glyph-bottom {
    animation-delay: 0.35s;
}

.double-y-wordmark--login {
    color: #222;
    background: #ffffff;
    padding: 12px 18px;
    border-radius: 14px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(102, 126, 234, 0.12);
}

.double-y-wordmark--login::before {
    background: radial-gradient(circle, rgba(102, 126, 234, 0.18) 0%, rgba(118, 75, 162, 0.1) 50%, transparent 72%);
    opacity: 0.85;
}

.double-y-wordmark--login::after {
    background: linear-gradient(
        120deg,
        transparent 28%,
        rgba(102, 126, 234, 0.22) 50%,
        transparent 72%
    );
}

.double-y-wordmark--login .double-y-name {
    background: linear-gradient(
        90deg,
        #667eea 0%,
        #764ba2 25%,
        #667eea 50%,
        #764ba2 75%,
        #667eea 100%
    );
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 2px rgba(102, 126, 234, 0.2));
}

.double-y-wordmark--login .double-y-glyph {
    filter: drop-shadow(0 0 4px rgba(102, 126, 234, 0.35));
}

@keyframes doubleYEntrance {
    0% {
        opacity: 0;
        transform: scale(0.82) translateY(12px);
    }
    70% {
        opacity: 1;
        transform: scale(1.04) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes doubleYFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes doubleYGlow {
    0%, 100% {
        opacity: 0.45;
        transform: scale(0.96);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.08);
    }
}

@keyframes doubleYShimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 220% center;
    }
}

@keyframes doubleYSweep {
    0%, 100% {
        opacity: 0;
        background-position: 180% center;
    }
    45% {
        opacity: 0.55;
        background-position: -20% center;
    }
}

@keyframes doubleYGlyphPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(0) invert(1) drop-shadow(0 0 4px rgba(255, 255, 255, 0.35));
    }
    50% {
        transform: scale(1.15) rotate(-3deg);
        filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255, 255, 255, 0.85));
    }
}

.double-y-wordmark--settled {
    animation: none !important;
    transform: none;
}

.double-y-wordmark--settled::before,
.double-y-wordmark--settled::after {
    animation: none !important;
    opacity: 0;
}

.double-y-wordmark--settled .double-y-name {
    animation: none !important;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: inherit;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.double-y-wordmark--settled .double-y-glyph {
    animation: none !important;
    transform: none;
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.double-y-wordmark--login.double-y-wordmark--settled .double-y-name {
    background: linear-gradient(90deg, #667eea, #764ba2);
    background-size: 100% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 1px 2px rgba(102, 126, 234, 0.2));
}

.double-y-wordmark--login.double-y-wordmark--settled .double-y-glyph {
    filter: drop-shadow(0 0 3px rgba(102, 126, 234, 0.25));
}

@media (prefers-reduced-motion: reduce) {
    .double-y-wordmark,
    .double-y-wordmark::before,
    .double-y-wordmark::after,
    .double-y-wordmark .double-y-name,
    .double-y-wordmark .double-y-glyph {
        animation: none !important;
    }

    .double-y-wordmark .double-y-name {
        -webkit-text-fill-color: currentColor;
        background: none;
        color: inherit;
    }
}

/* Legacy img logo (if used elsewhere) */
.double-y-logo {
    max-height: 80px;
    margin-bottom: 10px;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.45));
    animation: doubleYLogoPulse 2s ease-in-out forwards;
    transform-origin: center center;
}

@keyframes doubleYLogoPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 8px 20px rgba(0,0,0,0.45)) brightness(1);
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 16px 32px rgba(0,0,0,0.6)) brightness(1.3);
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 8px 20px rgba(0,0,0,0.45)) brightness(1);
    }
}

.header-content > h1 {
    display: none;
}

.header-content > p.header-page-title,
.header-content > p.header-search-users-label,
.header-content > p:not(.logged-session-info):first-of-type {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    opacity: 1;
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.logged-session-info {
    font-size: 0.98rem;
    font-weight: 600;
    opacity: 0.95;
    margin: 0 0 10px;
    position: relative;
    overflow: visible;
}

.logged-session-info i {
    margin-right: 4px;
    opacity: 0.88;
}

.logged-session-separator {
    margin: 0 8px;
    opacity: 0.75;
}

.logged-session-name {
    position: relative;
    display: inline-block;
}

.logged-session-name.has-photo {
    cursor: pointer;
}

.logged-session-photo-preview {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1200;
}

.logged-session-name.has-photo:hover .logged-session-photo-preview,
.logged-session-name.has-photo:focus-within .logged-session-photo-preview {
    opacity: 1;
    visibility: visible;
}

.logged-session-photo-preview img {
    display: block;
    width: 112px;
    height: 112px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    background: #f4f6f8;
}

.header-actions {
    margin-top: 15px;
}

.header-actions .btn {
    margin: 0 5px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.form-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 800px;
    margin: 20px 0;
}

.form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.form-header h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.form-header p {
    color: #666;
    font-size: 1rem;
}

.users-page .user-form-header {
    text-align: left;
}

.user-form-header-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-form-header-text {
    min-width: 0;
}

.user-header-photo-wrap {
    flex: 0 0 auto;
}

.user-header-photo-wrap[hidden],
.user-profile-photo-wrap[hidden],
.user-header-photo[hidden],
.user-field-photo[hidden],
.user-header-photo-initials[hidden],
.user-field-photo-initials[hidden] {
    display: none !important;
}

.user-header-photo,
.user-field-photo {
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #e1e5e9;
    background: #f4f6f8;
}

.user-header-photo-img,
.user-field-photo-img {
    display: block;
}

.user-header-photo,
.user-header-photo-initials {
    width: 72px;
    height: 72px;
}

.user-header-photo-initials,
.user-field-photo-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #667eea;
    background: linear-gradient(135deg, #eef1ff 0%, #f7f8ff 100%);
}

.user-header-photo-initials {
    font-size: 1.35rem;
}

.user-profile-photo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.user-profile-photo-wrap[hidden] {
    display: none !important;
}

.user-profile-photo-wrap .user-field-photo,
.user-profile-photo-wrap .user-field-photo-initials {
    width: 96px;
    height: 96px;
}

.user-profile-photo-wrap .user-field-photo-initials {
    font-size: 1.5rem;
}

.user-field-photo,
.user-field-photo-initials {
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #e1e5e9;
    background: #f4f6f8;
}

.user-field-photo-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #667eea;
    background: linear-gradient(135deg, #eef1ff 0%, #f7f8ff 100%);
}

@media (max-width: 600px) {
    .user-form-header-main {
        align-items: flex-start;
    }

    .user-header-photo,
    .user-header-photo-initials {
        width: 60px;
        height: 60px;
    }
}

/* Form Styles */
.funcionario-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group label i {
    margin-right: 8px;
    color: #667eea;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:invalid {
    border-color: #e74c3c;
}

.form-group input:valid {
    border-color: #27ae60;
}

.form-group input[type="file"] {
    padding: 10px;
    border: 2px dashed #e1e5e9;
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group input[type="file"]:hover {
    border-color: #667eea;
    background: #f0f0f0;
}

.form-group input[type="file"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#photoPreview {
    margin-top: 15px;
    text-align: center;
}

#photoPreviewImg {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 2px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-container input[type="checkbox"] {
    display: none;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    background: #ccc;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-label::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-container input[type="checkbox"]:checked + .toggle-label {
    background: #27ae60;
}

.toggle-container input[type="checkbox"]:checked + .toggle-label::after {
    transform: translateX(30px);
}

.toggle-text {
    font-weight: 600;
    color: #333;
}

/* Error Messages */
.error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.form-group.error input,
.form-group.error select {
    border-color: #e74c3c;
    background: #fdf2f2;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-width: 150px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 20px 30px;
    border-radius: 15px 15px 0 0;
    text-align: center;
}

.modal-header.success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.modal-header.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-header i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.modal-body p {
    margin-bottom: 20px;
    color: #666;
    font-size: 1.1rem;
}

.funcionario-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: left;
}

.funcionario-info h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.funcionario-info p {
    margin: 5px 0;
    color: #666;
    font-size: 0.95rem;
}

.modal-footer {
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #eee;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    color: white;
    opacity: 0.8;
    margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header-content > p.header-page-title,
    .header-content > p.header-search-users-label,
    .header-content > p:not(.logged-session-info):first-of-type {
        font-size: 1.4rem;
    }
    
    .form-container {
        padding: 20px;
        margin: 10px 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }

    .header-actions {
        justify-content: stretch;
    }

    .header-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .logged-session-info {
        font-size: 0.88rem;
        line-height: 1.5;
        white-space: normal;
        text-align: center;
        padding: 0 6px;
    }
    
    .modal-content {
        margin: 20% auto;
        width: 95%;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header-content > p.header-page-title,
    .header-content > p.header-search-users-label,
    .header-content > p:not(.logged-session-info):first-of-type {
        font-size: 1.25rem;
    }

    .logged-session-info {
        font-size: 0.82rem;
    }
    
    .form-container {
        padding: 15px;
    }
    
    .form-header h2 {
        font-size: 1.5rem;
    }
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Animation */
.success-animation {
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
