﻿
/* ========== 🎨 RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
    color: #333;
}

@@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ========== 🎴 Main Card ========== */
.login-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 960px;
    width: 100%;
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

@@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 🎯 Header ========== */
.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 30px;
    text-align: center;
    color: #fff;
}

    .login-header h1 {
        font-size: 1.8rem;
        font-weight: 700;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

        .login-header h1 i {
            font-size: 1.5rem;
        }

    .login-header p {
        font-size: 0.9rem;
        opacity: 0.9;
        margin: 5px 0 0;
    }

/* ========== 📐 Content Layout ========== */
.login-body {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0;
}

/* ========== 🕐 Clock Section ========== */
.clock-panel {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-right: 1px solid rgba(0,0,0,0.05);
}

.company-logo-wrapper {
    margin-bottom: 15px;
}

.company-logo {
    max-width: 160px;
    max-height: 65px;
    object-fit: contain;
}

.digital-time {
    font-family: 'Poppins', monospace;
    font-size: 2.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 10px 0;
}

.clock-visual {
    margin: 15px 0;
}

    .clock-visual canvas {
        border-radius: 50%;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }

.date-info {
    margin-top: 10px;
}

    .date-info .day {
        font-size: 1.2rem;
        font-weight: 600;
        color: #667eea;
        margin-bottom: 3px;
    }

    .date-info .full-date {
        font-size: 0.95rem;
        color: #6c757d;
    }

.info-tip {
    margin-top: 20px;
    padding: 12px 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border-left: 3px solid #667eea;
    font-size: 0.85rem;
    color: #555;
}

/* ========== 🔐 Form Section ========== */
.form-panel {
    padding: 40px 35px;
    background: #fff;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
    text-align: center;
}

.form-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 30px;
}

/* ========== 📝 Input Fields ========== */
.form-group {
    margin-bottom: 22px;
}

    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
        color: #495057;
        font-size: 0.9rem;
    }

.input-box {
    position: relative;
    display: flex;
    align-items: center;
}

    .input-box i.icon {
        position: absolute;
        left: 15px;
        color: #667eea;
        font-size: 1rem;
        z-index: 2;
        pointer-events: none;
        width: 20px;
        text-align: center;
    }

.form-control {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: #2c3e50 !important;
}

    .form-control:focus {
        outline: none;
        border-color: #667eea;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    }

    .form-control::placeholder {
        color: #adb5bd;
        opacity: 1;
    }

/* ========== 🔘 Options & Buttons ========== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 25px;
    font-size: 0.9rem;
}

.remember {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #495057;
    cursor: pointer;
}

    .remember input {
        width: 16px;
        height: 16px;
        accent-color: #667eea;
        cursor: pointer;
    }

.forgot {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

    .forgot:hover {
        text-decoration: underline;
    }

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    }

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.35);
}

    .btn-danger:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
    }

/* ========== ⏳ Loading ========== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.98);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102,126,234,0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 500;
    animation: fade 1.5s ease-in-out infinite;
}

@@keyframes fade {
    0%, 100% {
        opacity: 0.6
    }

    50% {
        opacity: 1
    }
}

/* ========== 🔔 MODERN TOAST NOTIFICATION ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    animation: toastSlideIn 0.4s ease-out;
    pointer-events: auto;
    border-left: 4px solid;
    position: relative;
    overflow: hidden;
}

@@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.hiding {
    animation: toastSlideOut 0.4s ease-out forwards;
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.toast.success {
    border-left-color: #10b981;
}

    .toast.success .toast-icon {
        background: rgba(16, 185, 129, 0.15);
        color: #10b981;
    }

.toast.error {
    border-left-color: #ef4444;
}

    .toast.error .toast-icon {
        background: rgba(239, 68, 68, 0.15);
        color: #ef4444;
    }

.toast.warning {
    border-left-color: #f59e0b;
}

    .toast.warning .toast-icon {
        background: rgba(245, 158, 11, 0.15);
        color: #f59e0b;
    }

.toast.info {
    border-left-color: #3b82f6;
}

    .toast.info .toast-icon {
        background: rgba(59, 130, 246, 0.15);
        color: #3b82f6;
    }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: #1f2937;
}

.toast-message {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.toast-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
    line-height: 1;
    transition: color 0.2s;
}

    .toast-close:hover {
        color: #4b5563;
    }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: toastProgress linear;
}

.toast.success .toast-progress {
    background: #10b981;
}

.toast.error .toast-progress {
    background: #ef4444;
}

.toast.warning .toast-progress {
    background: #f59e0b;
}

.toast.info .toast-progress {
    background: #3b82f6;
}

@@keyframes toastProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* ========== 📱 Responsive ========== */
@@media (max-width: 768px) {
    .login-body {
        grid-template-columns: 1fr;
    }

    .clock-panel {
        padding: 30px 25px;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    .form-panel {
        padding: 35px 25px;
    }

    .digital-time {
        font-size: 2.3rem;
    }

    .clock-visual {
        width: 150px;
        height: 150px;
    }

    .btn-row {
        flex-direction: column;
    }

    .form-options {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto;
        max-width: none;
        padding: 14px 16px;
    }
}
/* ========== ⏳ Modern Loading Screen ========== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientLoading 8s ease infinite;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
}

@@keyframes gradientLoading {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Background Overlay */
.loading-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Floating Shapes */
.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: floatShape 15s infinite ease-in-out;
}

.shape-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    right: 15%;
    animation-delay: 3s;
}

.shape-3 {
    width: 100px;
    height: 100px;
    top: 60%;
    left: 70%;
    animation-delay: 6s;
}

@@keyframes floatShape {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.3;
    }

    33% {
        transform: translate(30px, -30px) rotate(120deg) scale(1.1);
        opacity: 0.5;
    }

    66% {
        transform: translate(-20px, 20px) rotate(240deg) scale(0.9);
        opacity: 0.4;
    }
}

/* Loading Content */
.loading-content {
    text-align: center;
    z-index: 10;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    animation: contentFadeIn 0.6s ease-out;
}

@@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Logo */
.loading-logo {
    margin-bottom: 30px;
}

.logo-img {
    max-width: 180px;
    max-height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    animation: logoPulse 2s ease-in-out infinite;
}

@@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Spinner Container */
.spinner-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.spinner-ring-inner {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-bottom: 3px solid #fff;
    border-radius: 50%;
    animation: spinReverse 0.8s linear infinite;
}

.spinner-clock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

    .spinner-clock i {
        font-size: 28px;
        color: #667eea;
        animation: clockTick 1s ease-in-out infinite;
    }

@@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@@keyframes spinReverse {
    to {
        transform: rotate(-360deg);
    }
}

@@keyframes clockTick {
    0%, 100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-15deg);
    }

    75% {
        transform: rotate(15deg);
    }
}

/* Loading Text */
.loading-text-main h3 {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.loading-text-main p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 400;
}

/* Progress Bar */
.loading-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 25px 0 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #fff, #f093fb);
    border-radius: 10px;
    animation: progressAnimation 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@@keyframes progressAnimation {
    0% {
        width: 0%;
        margin-left: 0;
    }

    50% {
        width: 70%;
        margin-left: 0;
    }

    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Loading Dots */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

    .loading-dots span {
        width: 10px;
        height: 10px;
        background: #fff;
        border-radius: 50%;
        display: inline-block;
        animation: dotBounce 1.4s ease-in-out infinite;
    }

        .loading-dots span:nth-child(1) {
            animation-delay: 0s;
        }

        .loading-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .loading-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

@@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@@media (max-width: 768px) {
    .loading-content {
        padding: 30px 20px;
    }

    .logo-img {
        max-width: 140px;
        max-height: 55px;
    }

    .spinner-container {
        width: 100px;
        height: 100px;
    }

    .loading-text-main h3 {
        font-size: 1.3rem;
    }

    .floating-shape {
        display: none; /* ซ่อนบนมือถือเพื่อประสิทธิภาพ */
    }
}


