/* ============================================
   Triple S Insurance Broker - Doc Login Styles
   ============================================ */

/* ============================================
   Font Face - Kanit
   ============================================ */
@font-face {
    font-family: 'Kanit';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('/fonts/kanit/Kanit-Light.ttf') format('truetype');
}
@font-face {
    font-family: 'Kanit';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/kanit/Kanit-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Kanit';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/kanit/Kanit-Medium.ttf') format('truetype');
}
@font-face {
    font-family: 'Kanit';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/kanit/Kanit-SemiBold.ttf') format('truetype');
}
@font-face {
    font-family: 'Kanit';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/kanit/Kanit-Bold.ttf') format('truetype');
}

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --primary: #5BAEA7;
    --primary-hover: #4C9993;
    --accent: #F48A6D;
    --accent-hover: #E97254;
    --secondary: #A2D2CE;
    --neutral: #E8E3DC;
    --background: #FAFAFA;
    --text: #2C2C2C;
    --text-sub: #6E6E6E;
    --white: #FFFFFF;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    min-height: 100vh;
    display: flex;
    line-height: 1.5;
    background: var(--background);
    overflow-x: hidden;
}

/* ============================================
   Main Layout
   ============================================ */
.main-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ============================================
   Left Side - API Animation
   ============================================ */
.left-side {
    flex: 1;
    background: linear-gradient(135deg, #1a1f3c 0%, #2d3561 50%, #1a1f3c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 40px;
}

/* Animated Grid Background */
.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(91, 174, 167, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91, 174, 167, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Floating Particles */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    animation: particleFloat 15s linear infinite;
    opacity: 0;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { left: 30%; animation-delay: 4s; }
.particle:nth-child(4) { left: 40%; animation-delay: 1s; }
.particle:nth-child(5) { left: 50%; animation-delay: 3s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 2.5s; }
.particle:nth-child(8) { left: 80%; animation-delay: 4.5s; }
.particle:nth-child(9) { left: 90%; animation-delay: 1.5s; }
.particle:nth-child(10) { left: 15%; animation-delay: 3.5s; }

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* API Animation Content */
.api-showcase {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--white);
    max-width: 500px;
}

.api-logo {
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease;
}

.api-logo img {
    max-width: 200px;
    filter: brightness(0) invert(1);
}

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

.api-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.api-subtitle {
    font-size: 18px;
    opacity: 0.8;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease 0.3s both;
}

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

/* ============================================
   API Code Animation
   ============================================ */
.api-code-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 24px;
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    animation: fadeInUp 0.8s ease 0.4s both;
    border: 1px solid rgba(91, 174, 167, 0.3);
    backdrop-filter: blur(10px);
}

.code-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.code-dot.red { background: #ff5f56; }
.code-dot.yellow { background: #ffbd2e; }
.code-dot.green { background: #27ca40; }

.code-line {
    margin-bottom: 8px;
    opacity: 0;
    animation: typeLine 0.5s ease forwards;
}

.code-line:nth-child(2) { animation-delay: 0.8s; }
.code-line:nth-child(3) { animation-delay: 1.2s; }
.code-line:nth-child(4) { animation-delay: 1.6s; }
.code-line:nth-child(5) { animation-delay: 2.0s; }
.code-line:nth-child(6) { animation-delay: 2.4s; }
.code-line:nth-child(7) { animation-delay: 2.8s; }
.code-line:nth-child(8) { animation-delay: 3.2s; }
.code-line:nth-child(9) { animation-delay: 3.6s; }

@keyframes typeLine {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Code Syntax Highlighting */
.code-keyword { color: #c792ea; }
.code-method { color: #82aaff; }
.code-string { color: #c3e88d; }
.code-url { color: #89ddff; }
.code-property { color: #f07178; }
.code-number { color: #f78c6c; }
.code-comment { color: #546e7a; }
.code-bracket { color: #89ddff; }

/* ============================================
   Data Flow Animation
   ============================================ */
.data-flow-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.flow-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
    animation: flowAnim 4s linear infinite;
    opacity: 0.5;
}

.flow-line:nth-child(1) { top: 20%; width: 300px; left: -300px; animation-delay: 0s; }
.flow-line:nth-child(2) { top: 40%; width: 200px; left: -200px; animation-delay: 1s; }
.flow-line:nth-child(3) { top: 60%; width: 250px; left: -250px; animation-delay: 2s; }
.flow-line:nth-child(4) { top: 80%; width: 180px; left: -180px; animation-delay: 3s; }

@keyframes flowAnim {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 300px)); }
}

/* ============================================
   Floating API Icons
   ============================================ */
.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.float-icon {
    position: absolute;
    opacity: 0.15;
    animation: iconFloat 20s ease-in-out infinite;
}

.float-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--primary);
}

.float-icon:nth-child(1) { width: 60px; height: 60px; top: 10%; left: 10%; animation-delay: 0s; }
.float-icon:nth-child(2) { width: 80px; height: 80px; top: 30%; right: 15%; animation-delay: 3s; }
.float-icon:nth-child(3) { width: 50px; height: 50px; bottom: 20%; left: 20%; animation-delay: 6s; }
.float-icon:nth-child(4) { width: 70px; height: 70px; bottom: 30%; right: 10%; animation-delay: 9s; }

@keyframes iconFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(5deg); }
    50% { transform: translateY(-10px) rotate(-5deg); }
    75% { transform: translateY(-25px) rotate(3deg); }
}

/* ============================================
   Connection Nodes
   ============================================ */
.nodes-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.node {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: nodePulse 2s ease-in-out infinite;
}

.node::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    background: var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: nodeRipple 2s ease-out infinite;
}

.node:nth-child(1) { top: 15%; left: 25%; animation-delay: 0s; }
.node:nth-child(2) { top: 35%; left: 70%; animation-delay: 0.5s; }
.node:nth-child(3) { top: 55%; left: 40%; animation-delay: 1s; }
.node:nth-child(4) { top: 75%; left: 60%; animation-delay: 1.5s; }
.node:nth-child(5) { top: 85%; left: 20%; animation-delay: 0.75s; }

@keyframes nodePulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
}

@keyframes nodeRipple {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* ============================================
   Feature Cards
   ============================================ */
.feature-cards {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    animation: fadeInUp 0.8s ease 0.5s both;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    flex: 1;
    backdrop-filter: blur(5px);
    transition: transform 0.3s ease, background 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.feature-card svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    color: var(--primary);
}

.feature-card h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.feature-card p {
    font-size: 12px;
    opacity: 0.7;
}

/* ============================================
   Right Side - Login Form
   ============================================ */
.right-side {
    width: 480px;
    min-width: 480px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

.right-side::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--accent), var(--primary));
    background-size: 100% 200%;
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 0% 100%; }
}

.login-container {
    width: 100%;
    max-width: 360px;
    animation: slideInRight 0.6s ease;
}

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

/* ============================================
   Login Header
   ============================================ */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    color: var(--text);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-sub);
    font-size: 15px;
}

/* ============================================
   Form Styles
   ============================================ */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 14px;
}

.form-group label svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.input-wrapper {
    position: relative;
}

.input-wrapper > svg:first-of-type {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-sub);
    transition: color 0.3s ease;
    pointer-events: none;
}

.form-group input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    border: 2px solid var(--neutral);
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
    color: var(--text);
    background: var(--background);
}

.form-group input::placeholder {
    color: var(--text-sub);
}

.form-group input:hover {
    border-color: var(--secondary);
    background: var(--white);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(91, 174, 167, 0.15);
}

.form-group:focus-within .input-wrapper > svg:first-of-type {
    color: var(--primary);
}

/* ============================================
   Messages
   ============================================ */
.error-message {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #DC2626;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    border-left: 4px solid #DC2626;
    animation: shake 0.4s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.success-message {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #059669;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    border-left: 4px solid #059669;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   Button Styles
   ============================================ */
.btn-login {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(91, 174, 167, 0.35);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-login .btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s ease;
}

.btn-login .btn-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login.loading .btn-loader {
    display: block;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Password Toggle
   ============================================ */
.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-sub);
    transition: color 0.3s ease;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* ============================================
   Footer Section
   ============================================ */
.footer-section {
    margin-top: 32px;
    text-align: center;
}

.footer-section .tech-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.footer-section .tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--background);
    border: 1px solid var(--neutral);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-sub);
}

.footer-section .tech-badge svg {
    width: 14px;
    height: 14px;
    color: var(--primary);
}

.footer-text {
    color: var(--text-sub);
    font-size: 13px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    .left-side {
        min-height: 400px;
        padding: 30px;
    }

    .right-side {
        width: 100%;
        min-width: 100%;
        min-height: auto;
        padding: 40px 20px;
    }

    .right-side::before {
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: 4px;
    }

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

    .feature-cards {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .left-side {
        min-height: 350px;
    }

    .api-code-container {
        font-size: 12px;
        padding: 16px;
    }

    .feature-cards {
        display: none;
    }
}
