/* ===================================
   INDEX.PHP - CUSTOM STYLES
   =================================== */

/* ===== VARIÁVEIS CSS ===== */
:root {
    --admin-primary: #2c3e50;
    --admin-secondary: #34495e;
    --login-bg: #f6f7f9;
}

body {
    background-color: var(--login-bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 12% -10%, rgba(122, 197, 139, 0.18), transparent 60%),
        radial-gradient(circle at 90% 10%, rgba(217, 199, 79, 0.18), transparent 55%),
        radial-gradient(circle at 60% 80%, rgba(0, 0, 0, 0.04), transparent 60%);
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image: repeating-linear-gradient(
        120deg,
        rgba(0, 0, 0, 0.04) 0,
        rgba(0, 0, 0, 0.04) 1px,
        transparent 1px,
        transparent 14px
    );
    opacity: 0.08;
    z-index: -1;
    pointer-events: none;
}

/* ===== ALERTAS E MENSAGENS ===== */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    animation: slideInRight 0.3s ease-out;
    transition: all 0.3s ease;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert i {
    margin-right: 8px;
    font-size: 16px;
}

.btn-close {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    opacity: 1;
}

.btn-close::before {
    content: "×";
    font-weight: bold;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== MODAL DE LOADING ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 300px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* ===== FEEDBACK VISUAL NOS CAMPOS ===== */
.input-group.error input,
.input-group.error select {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.input-group.success input,
.input-group.success select {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* ===== SOBRESCREVER FLEX DO CONTAINER ===== */
.login-container {
    display: block !important;
    flex-direction: unset !important;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2.5rem;
}

/* ===== GRID LAYOUT PRINCIPAL ===== */
.main-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)) !important;
    gap: 2.5rem !important;
    align-items: stretch;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.back-home {
    text-align: center;
    margin-top: 2rem;
}

.back-home .btn-dark {
    display: inline-flex;
    width: auto;
    max-width: 360px;
    padding: 0.6rem 1.4rem;
    white-space: normal;
}

/* ===== TRANSIÇÕES DOS FORMULÁRIOS ===== */
.forms-wrapper {
    position: relative;
    min-height: 440px;
    background: white;
    padding: 2.25rem;
    border-radius: 18px;
    border: 1px solid #e7edf5;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.form-container {
    transition: all 0.3s ease;
    border: 1px solid #edf2f8;
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
}

.form-container.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    position: absolute;
    width: 100%;
}

.form-container:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
}

.forms-wrapper .form-container h2 {
    margin-bottom: 1.2rem;
}

.forms-wrapper .input-group input,
.forms-wrapper .input-group select,
.forms-wrapper .input-group textarea {
    width: 100%;
}

.forms-wrapper .btn-primary,
.forms-wrapper .btn-secondary {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    font-weight: 600;
}

/* ===== SEÇÃO CHECK-IN ===== */
.checkin-section {
    background: white;
    padding: 2.2rem 1.75rem;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.checkin-section h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
}

.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkin-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.qr-code-display {
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-secondary));
    border-radius: 15px;
    color: white;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.qr-code-display #qrcode-checkin,
.qr-code-display img {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 1rem;
    max-width: 220px;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.qr-instructions {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.95;
    line-height: 1.5;
}

.checkin-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid currentColor;
}

.info-item i {
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
}

.info-item strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.info-item small {
    color: #6c757d;
    line-height: 1.3;
}

.checkin-alternative {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.checkin-alternative p {
    margin: 0;
    font-size: 0.85rem;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 992px) {
    .main-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    .checkin-section {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    body {
        background: var(--login-bg);
    }

    .container {
        padding: 0 1rem 1.5rem;
        box-shadow: none;
    }

    .login-container {
        padding: 1.25rem;
        max-width: 100%;
    }

    .forms-wrapper {
        padding: 1.25rem;
        min-height: auto;
    }

    .form-container {
        padding: 1.25rem;
    }

    .form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .forms-wrapper .btn-primary,
    .forms-wrapper .btn-secondary {
        width: 100%;
    }

    .main-grid {
        gap: 1rem;
        grid-template-columns: 1fr !important;
    }

    .checkin-section {
        padding: 1.5rem;
        margin: 0;
        order: 1;
    }

    .qr-code-display {
        padding: 1.5rem 1.25rem;
        max-width: 360px;
    }

    .qr-code-display img {
        max-width: 160px;
        height: auto;
        aspect-ratio: 1 / 1;
        object-fit: contain;
    }

    .checkin-section h2 {
        font-size: 1.05rem;
    }

    .alert {
        margin: 10px;
        min-width: auto;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
    }

    .qr-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .checkin-section {
        padding: 1.5rem;
        margin: 1rem 0;
    }

    .main-grid {
        gap: 1.5rem;
    }

    .back-home {
        margin-top: 1.25rem;
    }

    .back-home .btn-dark {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .main-grid {
        grid-template-columns: 1fr !important;
    }

    .forms-wrapper,
    .form-container,
    .checkin-section {
        padding: 1.1rem;
    }

    .qr-code-display {
        max-width: 320px;
    }

    .qr-code-display img {
        max-width: 140px;
        aspect-ratio: 1 / 1;
        object-fit: contain;
    }
}
