/* ===============================
   MODAL SYSTEM - AUTH DIALOGS
   =============================== */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal-container {
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border: 2px solid rgba(232, 199, 66, 0.3);
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8) translateY(50px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
    padding: 2rem 2rem 1rem;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #cccccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(232, 199, 66, 0.2);
    color: #e8c742;
    transform: scale(1.1);
}

.modal-logo {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #e8c742, #f4d03f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    font-size: 1rem;
    color: #cccccc;
    margin-bottom: 1rem;
}

/* Modal Body */
.modal-body {
    padding: 2rem;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.5rem;
}

.modal-tab {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: #cccccc;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.modal-tab.active {
    background: linear-gradient(135deg, #e8c742, #f4d03f);
    color: #000000;
}

.modal-tab:hover:not(.active) {
    background: rgba(232, 199, 66, 0.1);
    color: #e8c742;
}

/* Form Styles */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #cccccc;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #e8c742;
    box-shadow: 0 0 0 3px rgba(232, 199, 66, 0.2);
}

.form-input::placeholder {
    color: #888888;
}

.form-input.error {
    border-color: #ff6b6b;
    animation: shakeError 0.5s ease-in-out;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: none;
}

.form-error.show {
    display: block;
}

/* Password Strength */
.password-strength {
    margin-top: 0.5rem;
    display: none;
}

.password-strength.show {
    display: block;
}

.strength-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-fill.weak {
    width: 33%;
    background: #ff6b6b;
}

.strength-fill.medium {
    width: 66%;
    background: #feca57;
}

.strength-fill.strong {
    width: 100%;
    background: #48ca8c;
}

.strength-text {
    font-size: 0.75rem;
    color: #888888;
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    accent-color: #e8c742;
}

.form-checkbox label {
    font-size: 0.9rem;
    color: #cccccc;
    cursor: pointer;
}

.form-checkbox a {
    color: #e8c742;
    text-decoration: none;
}

.form-checkbox a:hover {
    text-decoration: underline;
}

/* Submit Button */
.form-submit {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, #e8c742, #f4d03f);
    border: none;
    border-radius: 10px;
    color: #000000;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.form-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.form-submit:hover::before {
    left: 100%;
}

.form-submit:hover {
    background: linear-gradient(135deg, #f4d03f, #e8c742);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(232, 199, 66, 0.3);
}

.form-submit:active {
    transform: translateY(0);
}

.form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading State */
.form-submit.loading {
    pointer-events: none;
}

.form-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #000000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Social Login */
.social-login {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.social-title {
    text-align: center;
    color: #888888;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.social-buttons {
    display: flex;
    gap: 1rem;
}

.social-btn {
    flex: 1;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.social-btn.google {
    background: #db4437;
    border-color: #db4437;
}

.social-btn.facebook {
    background: #3b5998;
    border-color: #3b5998;
}

.social-btn.line {
    background: #00b900;
    border-color: #00b900;
}

/* Success Message */
.success-message {
    background: rgba(72, 202, 140, 0.1);
    border: 1px solid #48ca8c;
    color: #48ca8c;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: none;
    text-align: center;
}

.success-message.show {
    display: block;
}

/* Modal Footer */
.modal-footer {
    padding: 1rem 2rem 2rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-footer p {
    color: #888888;
    font-size: 0.9rem;
}

.modal-footer a {
    color: #e8c742;
    text-decoration: none;
    font-weight: 600;
}

.modal-footer a:hover {
    text-decoration: underline;
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */

/* Tablet */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-width: 400px;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem 1.5rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .social-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .modal-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
    }
    
    .modal-tabs {
        margin-bottom: 1.5rem;
    }
    
    .modal-tab {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-input {
        padding: 0.875rem;
    }
    
    .form-submit {
        padding: 1rem;
    }
}

/* ===============================
   ANIMATIONS
   =============================== */

/* Modal entrance animation */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal exit animation */
@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
}

/* Form transition */
.auth-form {
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

.auth-form.active {
    opacity: 1;
    transform: translateX(0);
}

/* ===============================
   DARK MODE SUPPORT
   =============================== */

@media (prefers-color-scheme: dark) {
    .modal-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    }
}

/* ===============================
   REDUCED MOTION
   =============================== */

@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-container,
    .form-input,
    .form-submit {
        transition: none;
    }
    
    .form-input.error {
        animation: none;
    }
    
    /* Disable scrollbar hover effects for reduced motion */
    ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #e8c742, #f4d03f);
        box-shadow: none;
    }
}

/* ===============================
   CUSTOM SCROLLBAR
   =============================== */

/* Custom Scrollbar for Modal */
.modal-container::-webkit-scrollbar {
    width: 8px;
}

.modal-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #e8c742, #f4d03f);
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f4d03f, #e8c742);
    box-shadow: 0 0 8px rgba(232, 199, 66, 0.3);
}

.modal-container::-webkit-scrollbar-corner {
    background: rgba(255, 255, 255, 0.1);
}

/* Global Scrollbar (for entire page) */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #e8c742, #f4d03f);
    border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f4d03f, #e8c742);
    box-shadow: 0 0 10px rgba(232, 199, 66, 0.4);
}

::-webkit-scrollbar-corner {
    background: #0a0a0a;
}

/* Firefox Scrollbar */
html {
    scrollbar-width: thin;
    scrollbar-color: #e8c742 #0a0a0a;
}

.modal-container {
    scrollbar-width: thin;
    scrollbar-color: #e8c742 rgba(255, 255, 255, 0.1);
}