:root {
    --primary-color: #00c45c;
    --primary-dark: #00a84d;
    --secondary-color: #667eea;
    --light-bg: #f8f9fa;
    --dark-bg: #1a1a1a;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 3vw, 20px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Suporte para dispositivos móveis com notch */
@supports (padding: max(0px)) {
    body {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

.auth-container {
    background: white;
    border-radius: clamp(16px, 3vw, 24px);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
    max-width: min(1200px, 95vw);
    min-height: min(700px, 90vh);
    display: flex;
    flex-direction: row;
    transition: all 0.3s ease;
    position: relative;
}

/* Layout para tablets grandes (768px - 1024px) */
@media (max-width: 1024px) {
    .auth-container {
        max-width: 95vw;
        min-height: auto;
        flex-direction: row;
        margin: 20px auto;
    }

    .auth-left,
    .auth-right {
        padding: clamp(20px, 4vw, 40px) !important;
    }
}

/* Layout para tablets (768px e abaixo) */
@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
        max-width: min(500px, 95vw);
        min-height: auto;
        margin: 10px auto;
    }

    .auth-left {
        min-height: 250px;
        padding: 30px 20px !important;
    }

    .auth-right {
        padding: 30px 20px !important;
    }

    .logo-auth {
        max-width: 150px !important;
    }

    .display-5 {
        font-size: 1.8rem !important;
    }

    .lead {
        font-size: 1rem !important;
    }
}

/* Layout para smartphones (480px e abaixo) */
@media (max-width: 480px) {
    body {
        padding: 5px;
        align-items: flex-start;
        min-height: 100vh;
    }

    .auth-container {
        border-radius: 12px;
        margin: 5px auto;
        min-height: calc(100vh - 10px);
    }

    .auth-left {
        min-height: 200px;
        padding: 20px 15px !important;
    }

    .auth-right {
        padding: 20px 15px !important;
    }

    .auth-tab {
        padding: 12px !important;
        font-size: 16px !important;
    }

    .form-control {
        padding: 12px !important;
        font-size: 16px !important;
        /* Prevenir zoom no iOS */
    }

    .btn-auth {
        padding: 14px !important;
        font-size: 16px !important;
    }

    .social-login {
        flex-direction: column;
        gap: 10px !important;
    }

    .feature-list li {
        font-size: 14px !important;
        margin-bottom: 12px !important;
    }

    .feature-list i {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
}

/* Layout para smartphones muito pequenos (360px e abaixo) */
@media (max-width: 360px) {
    .auth-container {
        border-radius: 10px;
    }

    .auth-left,
    .auth-right {
        padding: 15px 12px !important;
    }

    .logo-auth {
        max-width: 120px !important;
    }

    .display-5 {
        font-size: 1.5rem !important;
        margin-bottom: 15px !important;
    }

    .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    .col-md-6,
    .col-md-12 {
        padding-left: 8px;
        padding-right: 8px;
    }
}

.auth-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: clamp(30px, 5vw, 50px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
}

.auth-left-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.auth-right {
    flex: 1.2;
    padding: clamp(30px, 5vw, 50px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
}

.logo-auth {
    max-width: clamp(150px, 20vw, 200px);
    margin-bottom: clamp(20px, 3vw, 30px);
    filter: brightness(0) invert(1);
    height: auto;
}

.auth-tabs {
    display: flex;
    margin-bottom: clamp(20px, 3vw, 30px);
    border-bottom: 2px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-top: 10px;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: clamp(12px, 2vw, 15px);
    background: none;
    border: none;
    font-size: clamp(16px, 2vw, 18px);
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.auth-tab.active {
    color: var(--primary-color);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.auth-form {
    display: none;
    animation: fadeIn 0.5s ease;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

.auth-form.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-control {
    padding: clamp(12px, 2vw, 15px);
    border-radius: 10px;
    border: 2px solid #e1e5e9;
    font-size: clamp(15px, 2vw, 16px);
    transition: all 0.3s;
    min-height: 50px;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 196, 92, 0.1);
    outline: none;
}

.form-control.is-valid {
    border-color: #198754;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
}

.form-control.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
}

.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group-text {
    min-width: 50px;
    justify-content: center;
    border-right: none;
}

.input-group .form-control {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    z-index: 5;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-auth {
    padding: clamp(14px, 2vw, 15px);
    border-radius: 10px;
    font-size: clamp(15px, 2vw, 16px);
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary-auth {
    background: var(--primary-color);
    color: white;
}

.btn-primary-auth:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 196, 92, 0.2);
}

.btn-primary-auth:active {
    transform: translateY(0);
}

.social-login {
    display: flex;
    gap: clamp(10px, 2vw, 15px);
    margin-top: 20px;
}

.social-btn {
    flex: 1;
    padding: clamp(10px, 2vw, 12px);
    border-radius: 10px;
    border: 2px solid #e1e5e9;
    background: white;
    color: #666;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    touch-action: manipulation;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.social-btn:active {
    transform: translateY(0);
}

.social-btn.google {
    border-color: #db4437;
    color: #db4437;
}

.social-btn.facebook {
    border-color: #4267B2;
    color: #4267B2;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: clamp(20px, 4vw, 40px) 0;
}

.feature-list li {
    margin-bottom: clamp(15px, 3vw, 20px);
    display: flex;
    align-items: center;
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.4;
}

.feature-list i {
    background: rgba(255, 255, 255, 0.2);
    width: clamp(36px, 5vw, 40px);
    height: clamp(36px, 5vw, 40px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: clamp(12px, 2vw, 15px);
    font-size: clamp(16px, 2vw, 18px);
    flex-shrink: 0;
}

.alert {
    border-radius: 10px;
    border: none;
    padding: clamp(12px, 2vw, 15px);
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
    font-size: clamp(14px, 2vw, 16px);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.password-strength {
    margin-top: 10px;
}

.password-strength .progress {
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.password-strength .progress-bar {
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Modal responsivo */
.modal-dialog {
    max-width: 95vw;
    margin: 10px auto;
}

.modal-content {
    border-radius: 12px;
    border: none;
}

/* Suporte para telas muito altas */
@media (min-height: 900px) {
    .auth-container {
        min-height: 800px;
    }
}

/* Suporte para modo escuro */
@media (prefers-color-scheme: dark) {
    .auth-right {
        background: #1a1a1a;
        color: #fff;
    }

    .form-control {
        background-color: #2d2d2d;
        border-color: #444;
        color: #fff;
    }

    .form-control:focus {
        background-color: #2d2d2d;
        color: #fff;
    }

    .input-group-text {
        background-color: #333;
        border-color: #444;
        color: #fff;
    }

    .auth-tabs {
        background: #1a1a1a;
    }

    .auth-tab {
        color: #ccc;
    }

    .social-btn {
        background: #2d2d2d;
        border-color: #444;
        color: #ccc;
    }

    .text-muted {
        color: #999 !important;
    }
}

/* Melhorias para touch devices */
@media (hover: none) and (pointer: coarse) {

    .btn-auth:hover,
    .social-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .btn-auth:active,
    .social-btn:active {
        transform: scale(0.98);
    }

    .auth-tab {
        min-height: 44px;
        /* Tamanho mínimo para touch */
    }

    .form-control,
    .btn-auth,
    .social-btn {
        min-height: 44px;
        /* Tamanho mínimo para touch */
    }
}

/* Animação de loading */
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125em;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar personalizada para desktop */
@media (min-width: 769px) {
    .auth-form {
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) #f1f1f1;
    }

    .auth-form::-webkit-scrollbar {
        width: 6px;
    }

    .auth-form::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    .auth-form::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 3px;
    }
}

/* Impedir seleção de texto nos botões */
.auth-tab,
.btn-auth,
.social-btn,
.password-toggle {
    user-select: none;
    -webkit-user-select: none;
}

/* Garantir que os ícones não quebrem o layout */
.fas,
.fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ajustes para orientação paisagem em mobile */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .auth-container {
        max-height: 95vh;
        overflow-y: auto;
    }

    .auth-left {
        min-height: auto;
        padding: 20px !important;
    }

    .auth-right {
        padding: 20px !important;
    }

    .feature-list {
        display: none;
    }
}

/* Suporte para dispositivos com telas muito pequenas */
@media (max-width: 320px) {
    .auth-container {
        border-radius: 8px;
    }

    .auth-left,
    .auth-right {
        padding: 12px 10px !important;
    }

    .form-control,
    .btn-auth,
    .social-btn {
        font-size: 14px !important;
    }

    .auth-tab {
        font-size: 14px !important;
        padding: 10px !important;
    }
}


/* Indicador de verificação em tempo real */
.verificando {
    position: relative;
}

.verificando::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }

    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}