/* ========================================
 * REGISTER PAGE STYLES - โทนสีใหม่ตามภาพ
 * ใช้โทนสีไล่จากเขียวเข้มไปเขียวอ่อนและเหลืองครีม
 * ======================================== */

:root {
    /* โทนสีใหม่ตามภาพ - gradient จากเขียวเข้มไปเขียวอ่อนและเหลืองครีม */
    --teal-deep: #5fb3b3;      /* สีเขียวเข้ม (บนสุด) */
    --mint-medium: #88c999;     /* สีเขียวกลาง */
    --mint-light: #b8e6c1;      /* สีเขียวอ่อน */
    --cream-yellow: #f0e6a6;    /* สีเหลืองครีม (ล่างสุด) */
    
    /* สีหลักของระบบ */
    --primary-color: var(--teal-deep);
    --primary-light: var(--mint-medium);
    --primary-dark: #4a9999;
    
    /* Gradient Background ตามภาพ */
    --gradient-bg: linear-gradient(180deg, 
        var(--teal-deep) 0%, 
        var(--mint-medium) 33%, 
        var(--mint-light) 66%, 
        var(--cream-yellow) 100%);
        
    /* Secondary Colors */
    --success-color: var(--mint-medium);
    --warning-color: #f4d03f;
    --danger-color: #e74c3c;
    --info-color: var(--mint-light);
}

/* ========================================
 * BODY BACKGROUND
 * ======================================== */

body {
    font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
    background: var(--gradient-bg);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* ========================================
 * ANIMATED BACKGROUND PARTICLES
 * ======================================== */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 30%, rgba(95, 179, 179, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(136, 201, 153, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 60% 20%, rgba(184, 230, 193, 0.06) 0%, transparent 35%),
        radial-gradient(circle at 30% 80%, rgba(240, 230, 166, 0.05) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ========================================
 * MAIN CONTAINER STYLING
 * ======================================== */

.container {
    position: relative;
    z-index: 1;
}

/* ========================================
 * CARD STYLING - ปรับให้เข้ากับโทนสีใหม่
 * ======================================== */

.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(95, 179, 179, 0.2);
    border-radius: 1.5rem;
    box-shadow: 
        0 15px 35px rgba(95, 179, 179, 0.15),
        0 5px 15px rgba(136, 201, 153, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    transition: all 0.4s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 20px 45px rgba(95, 179, 179, 0.2),
        0 10px 20px rgba(136, 201, 153, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

/* ========================================
 * CARD HEADER - ใช้ gradient ตามโทนสีใหม่
 * ======================================== */

.card-header {
    background: linear-gradient(135deg, var(--teal-deep) 0%, var(--mint-medium) 100%) !important;
    border-bottom: none;
    color: white !important;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: headerShine 3s ease-in-out infinite;
}

@keyframes headerShine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: -100%; }
}

.card-header h4 {
    margin: 0;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

/* ========================================
 * FORM STYLING - อัปเดตสีใหม่
 * ======================================== */

.form-label {
    color: var(--teal-deep);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-label .text-danger {
    color: var(--danger-color) !important;
}

/* ========================================
 * INPUT GROUP STYLING
 * ======================================== */

.input-group-text {
    background: linear-gradient(135deg, var(--teal-deep) 0%, var(--mint-medium) 100%);
    color: white;
    border: 1px solid var(--teal-deep);
    border-right: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.input-group .form-control {
    border-left: none;
    border-color: var(--teal-deep);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.input-group .form-control:focus {
    border-color: var(--mint-medium);
    box-shadow: 0 0 0 0.2rem rgba(95, 179, 179, 0.25);
    background: white;
}

.input-group:focus-within .input-group-text {
    background: linear-gradient(135deg, var(--mint-medium) 0%, var(--mint-light) 100%);
    border-color: var(--mint-medium);
}

/* สำหรับ toggle password button */
.input-group .btn-outline-secondary {
    border-left: none;
    border-color: var(--teal-deep);
    color: var(--teal-deep);
    background: white;
}

.input-group .btn-outline-secondary:hover {
    background: var(--mint-light);
    color: var(--teal-deep);
    border-color: var(--mint-medium);
}

/* ========================================
 * BUTTON STYLING - โทนสีใหม่
 * ======================================== */

.btn-primary {
    background: linear-gradient(135deg, var(--teal-deep) 0%, var(--mint-medium) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::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-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--teal-deep) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(95, 179, 179, 0.3);
}

.btn-primary:focus {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--teal-deep) 100%);
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(95, 179, 179, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ========================================
 * ALERT STYLING - อัปเดตสีตามโทน
 * ======================================== */

.alert-danger {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(231, 76, 60, 0.05) 100%);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #c0392b;
    border-radius: 0.75rem;
}

.alert-success {
    background: linear-gradient(135deg, rgba(136, 201, 153, 0.1) 0%, rgba(184, 230, 193, 0.05) 100%);
    border: 1px solid var(--mint-medium);
    color: var(--teal-deep);
    border-radius: 0.75rem;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(240, 230, 166, 0.1) 0%, rgba(240, 230, 166, 0.05) 100%);
    border: 1px solid var(--warning-color);
    color: #b8860b;
    border-radius: 0.75rem;
}

.alert-info {
    background: linear-gradient(135deg, rgba(184, 230, 193, 0.1) 0%, rgba(184, 230, 193, 0.05) 100%);
    border: 1px solid var(--mint-light);
    color: var(--teal-deep);
    border-radius: 0.75rem;
}

/* ========================================
 * PASSWORD STRENGTH METER
 * ======================================== */

.password-strength {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pw-very-weak { 
    background: linear-gradient(90deg, #dc3545 0%, #e74c3c 100%); 
    width: 20%; 
}

.pw-weak { 
    background: linear-gradient(90deg, #ffc107 0%, #f39c12 100%); 
    width: 40%; 
}

.pw-medium { 
    background: linear-gradient(90deg, #fd7e14 0%, #e67e22 100%); 
    width: 60%; 
}

.pw-strong { 
    background: linear-gradient(90deg, var(--mint-medium) 0%, var(--mint-light) 100%); 
    width: 80%; 
}

.pw-very-strong { 
    background: linear-gradient(90deg, var(--teal-deep) 0%, var(--mint-medium) 100%); 
    width: 100%; 
}

/* ========================================
 * FORM TEXT AND HELP TEXT
 * ======================================== */

.form-text {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-text.text-success {
    color: var(--success-color) !important;
    font-weight: 500;
}

.form-text.text-danger {
    color: var(--danger-color) !important;
    font-weight: 500;
}

/* ========================================
 * CHECKBOX STYLING
 * ======================================== */

.form-check-input:checked {
    background-color: var(--teal-deep);
    border-color: var(--teal-deep);
}

.form-check-input:focus {
    border-color: var(--mint-medium);
    box-shadow: 0 0 0 0.2rem rgba(95, 179, 179, 0.25);
}

.form-check-label {
    color: #495057;
    font-weight: 500;
}

.form-check-label a {
    color: var(--teal-deep);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.form-check-label a:hover {
    color: var(--mint-medium);
    text-decoration: underline;
}

/* ========================================
 * MODAL STYLING
 * ======================================== */

.modal-header {
    background: linear-gradient(135deg, var(--teal-deep) 0%, var(--mint-medium) 100%);
    color: white;
    border-bottom: none;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    background: rgba(255, 255, 255, 0.98);
    color: #495057;
    line-height: 1.6;
}

.modal-body h5 {
    color: var(--teal-deep);
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.modal-body h5:first-child {
    margin-top: 0;
}

.modal-footer {
    background: rgba(248, 249, 250, 0.98);
    border-top: 1px solid rgba(95, 179, 179, 0.1);
}

.modal-footer .btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, var(--teal-deep) 0%, var(--mint-medium) 100%);
    border: none;
}

/* ========================================
 * LINK STYLING
 * ======================================== */

a {
    color: var(--teal-deep);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--mint-medium);
    text-decoration: underline;
}

/* ========================================
 * VALIDATION STATES
 * ======================================== */

.was-validated .form-control:valid {
    border-color: var(--mint-medium);
    background-image: none;
}

.was-validated .form-control:invalid {
    border-color: var(--danger-color);
    background-image: none;
    animation: inputShake 0.5s ease;
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.valid-feedback {
    color: var(--success-color);
    font-weight: 500;
}

.invalid-feedback {
    color: var(--danger-color);
    font-weight: 500;
}

/* ========================================
 * NAVBAR OVERRIDE สำหรับหน้านี้
 * ======================================== */

.navbar-dark {
    background: linear-gradient(135deg, var(--teal-deep) 0%, var(--mint-medium) 50%, var(--mint-light) 100%) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(95, 179, 179, 0.2);
    box-shadow: 0 2px 15px rgba(95, 179, 179, 0.15);
}

/* ========================================
 * RESPONSIVE DESIGN
 * ======================================== */

@media (max-width: 768px) {
    .card {
        margin: 1rem;
        border-radius: 1rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .btn-primary {
        padding: 0.75rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0.5rem;
    }
    
    .card {
        margin: 0.5rem;
        border-radius: 0.75rem;
    }
    
    .row.mb-3 {
        margin-bottom: 1rem !important;
    }
    
    .col-md-6 {
        margin-bottom: 1rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* ========================================
 * ACCESSIBILITY ENHANCEMENTS
 * ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.visually-hidden-focusable:focus {
    background: var(--teal-deep);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
}

/* ========================================
 * HIGH CONTRAST MODE SUPPORT
 * ======================================== */

@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--teal-deep);
        background: white;
    }
    
    .card-header {
        background: var(--teal-deep) !important;
        color: white !important;
    }
    
    .form-label {
        color: #000;
        font-weight: bold;
    }
    
    .btn-primary {
        background: var(--teal-deep) !important;
        border: 2px solid white;
    }
    
    .btn-primary:hover {
        background: white !important;
        color: var(--teal-deep) !important;
        border: 2px solid var(--teal-deep);
    }
}

/* ========================================
 * PRINT STYLES
 * ======================================== */

@media print {
    body {
        background: white !important;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
        background: white;
    }
    
    .card-header {
        background: #f8f9fa !important;
        color: #000 !important;
    }
}

/* Keep registration UI aligned with login.php */
.register-page {
    font-family: 'IBM Plex Sans Thai', sans-serif;
    background: var(--gradient-bg);
    color: #173b39;
}

.register-page .register-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.register-page .register-container > .row {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
}

.register-page .register-container > .row > [class*="col-"] {
    margin-right: auto;
    margin-left: auto;
}

.register-page .register-card,
.register-page .card.mt-3 {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(95, 179, 179, .15), 0 0 0 1px rgba(255, 255, 255, .1) inset;
}

.register-page .register-card:hover,
.register-page .card.mt-3:hover {
    transform: translateY(-3px);
}

.register-page .register-header {
    background: transparent !important;
    color: #173b39 !important;
    border: 0;
    padding: 1.75rem 2rem .5rem;
}

.register-page .register-header::before {
    display: none;
}

.register-page .register-logo {
    border-radius: 50%;
    object-fit: cover;
}

.register-page .register-header h1 {
    font-family: Inter, 'IBM Plex Sans Thai', sans-serif;
    font-weight: 700;
}

.register-page .card-body {
    padding: 1.5rem 2rem 1.75rem;
}

.register-page .register-form label,
.register-page .register-form .form-label {
    color: #173b39;
    font-weight: 600;
}

.register-page .register-form .input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.register-page .register-form .input-group > .input-group-text {
    flex: 0 0 44px;
    height: 44px;
    justify-content: center;
    padding: .625rem .75rem;
    border: 1px solid var(--teal-deep) !important;
    border-right: 0 !important;
    border-radius: .375rem 0 0 .375rem !important;
    background: var(--teal-deep) !important;
    color: #fff !important;
}

.register-page .register-form .input-group > .form-control {
    min-width: 0;
    flex: 1 1 auto;
    height: 44px;
    border: 1px solid var(--teal-deep) !important;
    border-radius: 0 .375rem .375rem 0 !important;
    background: #fff;
}

.register-page .register-form .input-group > .form-control:focus {
    border-color: var(--teal-deep) !important;
    box-shadow: 0 0 0 .2rem rgba(95, 179, 179, .2);
}

.register-page .register-form .form-control.is-invalid,
.register-page .register-form .was-validated .form-control:invalid {
    border-color: #dc3545 !important;
}

/* Only join an input to a trailing action button. Validation feedback is also
   an input-group child, so :not(:last-child) incorrectly removed the right
   border from every regular field. */
.register-page .register-form .input-group > .form-control.input-with-action {
    border-radius: 0 !important;
    border-right: 0 !important;
}

.register-page .register-form .input-group > .btn-outline-secondary {
    height: 44px;
    border-color: var(--teal-deep) !important;
    border-radius: 0 .375rem .375rem 0 !important;
    color: var(--teal-deep);
    background: #fff;
}

.register-page .register-form .input-group > .invalid-feedback {
    flex: 0 0 100%;
    width: 100%;
    margin-top: .375rem;
}

.register-page .register-form .btn-primary {
    min-height: 48px;
    font-family: Inter, 'IBM Plex Sans Thai', sans-serif;
}

@media (max-width: 768px) {
    .register-page .register-container {
        align-items: flex-start;
        padding: .75rem .5rem;
    }

    .register-page .register-card,
    .register-page .card.mt-3 {
        margin-left: 0;
        margin-right: 0;
        border-radius: 1rem;
    }

    .register-page .register-header {
        padding: 1.25rem 1.25rem .25rem;
    }

    .register-page .card-body {
        padding: 1.25rem;
    }
}

@media (max-width: 576px) {
    .register-page .register-form .row.mb-3 > [class*="col-md-"] {
        margin-bottom: 1rem;
    }

    .register-page .register-form .row.mb-3 > [class*="col-md-"]:last-child {
        margin-bottom: 0;
    }
}
