@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --wirbi-blue: #6422FF;
    --wirbi-red: #FF5032;
    --wirbi-cyan: #32FFFF;
    --wirbi-purple: #9600D7;
    --wirbi-pink: #C83C78;
    --wirbi-dark: #231F20;
    --wirbi-light: #F2F2F2;
    --wirbi-green: #00FF88;
    --wirbi-yellow: #FFB800;
    --wirbi-gradient: linear-gradient(135deg, #6422FF 0%, #9600D7 25%, #C83C78 50%, #FF5032 100%);
    --wirbi-gradient-dark: linear-gradient(135deg, #3C1469 0%, #1E1E78 50%, #280028 100%);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    background: var(--wirbi-gradient);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Malla de fondo optimizada */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.1;
    background-image: 
        repeating-linear-gradient(60deg, transparent, transparent 100px, rgba(255,255,255,0.05) 100px, rgba(255,255,255,0.05) 200px),
        repeating-linear-gradient(-60deg, transparent, transparent 100px, rgba(255,255,255,0.05) 100px, rgba(255,255,255,0.05) 200px);
    pointer-events: none;
    z-index: 1;
}

/* Contenedor principal optimizado */
.main-container {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Card de login compacto */
.login-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    width: 100%;
    max-width: 1200px;
    display: flex;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-height: 500px;
    height: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Panel izquierdo - Login */
.login-panel {
    flex: 1;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    min-width: 400px;
    min-height: auto;
}

/* Logo optimizado */
.logo-section {
    margin-bottom: 32px;
    animation: fadeIn 0.6s ease-out 0.1s both;
}

.wirbi-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.wirbi-logo img {
    height: 40px;
    width: auto;
}

.login-header h2 {
    font-size: 32px;
    font-weight: 800;
    color: var(--wirbi-dark);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.login-header p {
    font-size: 16px;
    color: #666;
    line-height: 1.4;
}

/* Formulario optimizado */
.login-form {
    margin-top: 32px;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--wirbi-dark);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

.microsoft-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--wirbi-dark);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.microsoft-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--wirbi-gradient);
    transition: left 0.4s;
    opacity: 0.3;
}

.microsoft-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(100, 34, 255, 0.25);
}

.microsoft-btn:hover::before {
    left: 0;
}

.microsoft-btn:active {
    transform: scale(0.98);
}

/* Info de cuenta compacta */
.account-info {
    margin-top: 24px;
    padding: 16px;
    background: var(--wirbi-light);
    border-radius: 12px;
    animation: fadeIn 0.6s ease-out 0.3s both;
}

.account-info-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.info-icon {
    width: 20px;
    height: 20px;
    background: var(--wirbi-gradient);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-info h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--wirbi-dark);
    letter-spacing: -0.2px;
}

.account-info ul {
    list-style: none;
    margin: 0;
}

.account-info li {
    color: #666;
    font-size: 12px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.check-mark {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, var(--wirbi-blue), var(--wirbi-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.check-mark svg {
    width: 8px;
    height: 8px;
}

/* Panel derecho - Dashboard preview */
.dashboard-preview {
    flex: 1.1;
    background: linear-gradient(135deg, var(--wirbi-blue) 0%, var(--wirbi-purple) 50%, var(--wirbi-pink) 100%);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-width: 400px;
    min-height: auto;
}

/* Grid de fondo */
.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(30deg, transparent 49.5%, rgba(255,255,255,0.05) 49.5%, rgba(255,255,255,0.05) 50.5%, transparent 50.5%),
        linear-gradient(-30deg, transparent 49.5%, rgba(255,255,255,0.05) 49.5%, rgba(255,255,255,0.05) 50.5%, transparent 50.5%);
    background-size: 50px 50px;
    opacity: 0.4;
}

/* Header del dashboard */
.dashboard-header {
    position: relative;
    z-index: 5;
    margin-bottom: 32px;
}

.dashboard-title {
    color: white;
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    animation: fadeIn 0.6s ease-out;
    line-height: 1.1;
}

.dashboard-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: 400;
    animation: fadeIn 0.6s ease-out 0.1s both;
}

/* Grid de herramientas compacto */
.tools-grid {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.tool-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    animation: fadeInScale 0.6s ease-out forwards;
    opacity: 0;
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.15s; }
.tool-card:nth-child(3) { animation-delay: 0.2s; }
.tool-card:nth-child(4) { animation-delay: 0.25s; }
.tool-card:nth-child(5) { animation-delay: 0.3s; }
.tool-card:nth-child(6) { animation-delay: 0.35s; }

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tool-card:hover {
    transform: translateY(-3px) scale(1.02);
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.tool-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 18px;
}

.tool-name {
    color: white;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.tool-desc {
    color: rgba(255, 255, 255, 0.75);
    font-size: 11px;
    line-height: 1.4;
}

/* Footer compacto */
.login-footer {
    position: absolute;
    bottom: 24px;
    left: 48px;
    right: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeIn 0.6s ease-out 0.4s both;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: #999;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.3s;
    padding: 4px 0;
}

.footer-links a:hover {
    color: var(--wirbi-blue);
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #999;
    font-size: 11px;
}

/* Responsive optimizado */
@media (max-width: 1024px) {
    .login-card {
        max-width: 100%;
        flex-direction: column;
        min-height: auto;
        height: auto;
    }

    .login-panel, .dashboard-preview {
        min-width: auto;
    }

    .dashboard-preview {
        padding: 40px;
        min-height: 400px;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .main-container {
        padding: 0;
        min-height: 100vh;
        overflow-y: visible;
    }

    .login-card {
        border-radius: 0;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        display: flex;
        flex-direction: column;
    }

    .dashboard-preview {
        display: none;
    }

    .login-panel {
        padding: 32px 24px;
        justify-content: center;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .login-header h2 {
        font-size: 28px;
    }

    .login-header p {
        font-size: 15px;
    }

    .login-footer {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        margin-top: 32px;
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .login-panel {
        padding: 24px 20px;
        min-height: auto;
        justify-content: flex-start;
        padding-top: 40px;
    }

    .logo-section {
        text-align: center;
        margin-bottom: 24px;
    }

    .wirbi-logo {
        justify-content: center;
    }

    .login-header {
        text-align: center;
    }

    .login-header h2 {
        font-size: 24px;
        margin-bottom: 6px;
    }

    .login-header p {
        font-size: 14px;
    }

    .microsoft-btn {
        padding: 12px 20px;
        font-size: 14px;
        gap: 8px;
    }

    .account-info {
        padding: 14px;
        margin-top: 20px;
    }

    .account-info li {
        font-size: 11px;
        padding: 3px 0;
    }

    .check-mark {
        width: 12px;
        height: 12px;
    }

    .footer-links a {
        font-size: 11px;
    }

    .security-badge {
        font-size: 10px;
    }
}

@media (max-width: 380px) {
    .login-panel {
        padding: 20px 16px;
    }

    .login-header h2 {
        font-size: 22px;
    }

    .account-info {
        padding: 12px;
    }

    .account-info h3 {
        font-size: 12px;
    }

    .account-info li {
        font-size: 10px;
        gap: 6px;
    }
}

/* Optimizaciones para pantallas grandes */
@media (min-width: 1440px) {
    .login-card {
        max-width: 1400px;
    }

    .login-panel {
        padding: 60px;
    }

    .dashboard-preview {
        padding: 60px;
    }

    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1920px) {
    .main-container {
        max-width: 1920px;
        margin: 0 auto;
    }

    .login-card {
        max-width: 1600px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* iPad y tablets en landscape */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .login-card {
        flex-direction: row;
        min-height: auto;
    }

    .login-panel {
        padding: 32px;
    }

    .dashboard-preview {
        display: flex;
        padding: 32px;
    }

    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Móviles muy pequeños en landscape */
@media (max-width: 667px) and (orientation: landscape) and (max-height: 414px) {
    body {
        overflow-y: auto;
    }

    .main-container {
        min-height: auto;
        padding: 8px;
    }

    .login-card {
        min-height: auto;
    }

    .login-panel {
        padding: 16px 20px;
        min-height: auto;
    }

    .logo-section {
        display: flex;
        align-items: center;
        gap: 16px;
        margin-bottom: 12px;
    }

    .wirbi-logo {
        margin-bottom: 0;
    }

    .login-header {
        flex: 1;
    }

    .login-header h2 {
        font-size: 18px;
    }

    .login-header p {
        font-size: 12px;
    }

    .login-form {
        margin-top: 12px;
    }

    .microsoft-btn {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 36px;
    }

    .account-info {
        display: none;
    }

    .login-footer {
        display: none;
    }
}
@media (max-height: 600px) and (orientation: landscape) {
    body {
        overflow-y: auto;
    }

    .main-container {
        min-height: auto;
        padding: 10px;
    }

    .login-card {
        min-height: auto;
        margin: auto;
    }

    .login-panel {
        padding: 24px 32px;
        min-height: auto;
    }

    .dashboard-preview {
        display: flex;
        padding: 24px 32px;
        min-height: auto;
    }

    .logo-section {
        margin-bottom: 16px;
    }

    .login-header h2 {
        font-size: 24px;
    }

    .login-header p {
        font-size: 14px;
    }

    .login-form {
        margin-top: 16px;
    }

    .account-info {
        display: none;
    }

    .dashboard-header {
        margin-bottom: 16px;
    }

    .dashboard-title {
        font-size: 28px;
    }

    .dashboard-subtitle {
        font-size: 16px;
    }

    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .tool-card {
        padding: 10px;
    }

    .tool-icon {
        width: 28px;
        height: 28px;
        margin-bottom: 8px;
        font-size: 14px;
    }

    .tool-name {
        font-size: 12px;
    }

    .tool-desc {
        font-size: 10px;
    }

    .login-footer {
        display: none;
    }
}

@media (max-width: 812px) and (orientation: landscape) {
    .dashboard-preview {
        display: none;
    }

    .login-panel {
        justify-content: center;
        max-width: 500px;
        margin: 0 auto;
    }

    .account-info {
        display: block;
    }

    .login-footer {
        display: flex;
        position: relative;
        margin-top: 20px;
    }
}

@media (max-height: 420px) and (orientation: landscape) {
    .login-card {
        flex-direction: row;
    }

    .login-panel {
        padding: 16px 24px;
    }

    .logo-section {
        display: flex;
        align-items: center;
        gap: 20px;
    }

    .wirbi-logo {
        margin-bottom: 0;
    }

    .login-header {
        flex: 1;
    }

    .login-header h2 {
        font-size: 20px;
    }

    .login-header p {
        font-size: 12px;
    }

    .microsoft-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    .microsoft-btn {
        min-height: 44px;
    }

    .tool-card:hover {
        transform: none;
    }

    .tool-card:active {
        transform: scale(0.98);
    }

    .footer-links a {
        padding: 8px 4px;
    }
}

/* Focus visible para accesibilidad */
*:focus-visible {
    outline: 2px solid var(--wirbi-blue);
    outline-offset: 2px;
}

.microsoft-btn:focus-visible {
    outline-offset: 3px;
}

/* Prevenir zoom en iOS */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Prevenir bounce scroll en iOS */
    body {
        position: relative;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Loading overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.96);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top: 3px solid var(--wirbi-blue);
    animation: spin 1.2s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 75%;
    height: 75%;
    top: 12.5%;
    left: 12.5%;
    border-top-color: var(--wirbi-purple);
    animation-delay: 0.15s;
}

.spinner-ring:nth-child(3) {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    border-top-color: var(--wirbi-pink);
    animation-delay: 0.3s;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    color: var(--wirbi-dark);
    font-size: 14px;
    font-weight: 600;
}

/* Mensajes de notificación */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 13px;
    display: none;
    animation: slideDown 0.3s ease-out;
    z-index: 3000;
    min-width: 250px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

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

.notification.active {
    display: block;
}

.notification.error {
    background: #FFF5F5;
    border: 1px solid #FFB8B8;
    color: #C41E3A;
}

.notification.success {
    background: #F0FFF4;
    border: 1px solid #84E1A6;
    color: #00875A;
}