/* ===== Modal Container & Backdrop ===== */
.modal-container {
    opacity: 0;
    transform: translateX(-100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
}

.modal-container.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.4s ease;
    backdrop-filter: blur(0px);
}

.modal-backdrop.active {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 480px;
    max-width: 90%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.modal-container.active .modal-content {
    transform: translateX(0);
}

/* Custom scrollbar */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.modal-content::-webkit-scrollbar-thumb {
    background: #FF4B4B;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #ff3333;
}

/* ===== Modal Header ===== */
.modal-header {
    position: sticky;
    top: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 75, 75, 0.1);
    z-index: 10;
}

.modal-close {
    background: transparent;
    border: 2px solid #FF4B4B;
    color: #FF4B4B;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #FF4B4B;
    color: #000;
    transform: rotate(90deg);
    box-shadow: 0 0 20px rgba(255, 75, 75, 0.5);
}

/* ===== Modal Body ===== */
.modal-body {
    padding: 40px 30px;
}

/* ===== Login & Signup Panels ===== */
.login-panel,
.signup-panel {
    opacity: 0;
    display: none;
}

.login-panel.active,
.signup-panel.active {
    display: block;
    animation: fadeInUp 0.6s ease forwards;
}

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

/* ===== Modal Language Dropdown (modern, dark) ===== */
.modal-lang-dropdown {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.modal-lang-current {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.modal-lang-current:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    transform: translateY(-1px);
}

.modal-lang-caret {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid rgba(255, 255, 255, 0.7);
    transition: transform 0.18s ease;
}

.modal-lang-dropdown.open .modal-lang-caret {
    transform: rotate(180deg);
}

.modal-lang-options {
    position: absolute;
    margin-top: 6px;
    right: 30px;
    background: rgba(10, 10, 10, 0.98);
    border-radius: 12px;
    list-style: none;
    padding: 4px 0;
    min-width: 110px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.75);
    display: none;
    z-index: 120;
}

.modal-lang-options.open {
    display: block;
    animation: fadeInDown 0.18s ease-out;
}

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

.modal-lang-options li {
    padding: 9px 16px;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.modal-lang-options li:hover,
.modal-lang-options li.selected {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* ===== Typography ===== */
.login-panel h2,
.signup-panel h1 {
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    animation: slideInRight 0.5s ease 0.3s both;
}

.login-panel p,
.signup-panel p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 30px;
    line-height: 1.6;
    animation: slideInRight 0.5s ease 0.4s both;
}

/* ===== Form Styles ===== */
form {
    animation: slideInRight 0.5s ease 0.5s both;
    width: 100%;
    box-sizing: border-box;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    box-sizing: border-box;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="tel"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: #FF4B4B;
    box-shadow: 0 0 20px rgba(255, 75, 75, 0.2);
    transform: translateY(-2px);
}

/* Input error state */
input.input-error {
    border-color: #ff3333 !important;
    background: rgba(255, 51, 51, 0.1) !important;
    animation: shake 0.3s ease;
}

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

/* ===== Forgot Password Link ===== */
.forgot {
    display: inline-block;
    color: #FF4B4B;
    font-size: 13px;
    margin-bottom: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.forgot::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #FF4B4B;
    transition: width 0.3s ease;
}

.forgot:hover {
    color: #ff3333;
    transform: translateX(4px);
}

.forgot:hover::after {
    width: 100%;
}

/* ===== Buttons ===== */
.login-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #FF4B4B 0%, #ff3333 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(255, 75, 75, 0.3);
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.login-btn:hover::before {
    width: 300px;
    height: 300px;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 75, 75, 0.5);
}

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

/* Loading state for buttons */
.login-btn.btn-loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.login-btn.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spinner 0.8s linear infinite;
}

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

/* ===== Terms Checkbox ===== */
.terms-checkbox {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.terms-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin-top: 2px;
    margin-bottom: 0;
    padding: 0;
    accent-color: #FF4B4B;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

.terms-checkbox label {
    color: #ffffff;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
    flex: 1;
}

.terms-checkbox label a.link {
    color: #FF4B4B;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.terms-checkbox label a.link:hover {
    color: #ff6b6b;
}

/* ===== Bottom Links ===== */
.login-panel > p:last-of-type,
.signup-panel > p:last-of-type {
    margin-top: 30px;
    text-align: center;
    animation: fadeIn 0.5s ease 0.7s both;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.login-link {
    color: #FF4B4B;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
}

.login-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #FF4B4B;
    transition: width 0.3s ease;
}

.login-link:hover {
    color: #ff3333;
}

.login-link:hover::after {
    width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== Panel Switching Animation ===== */
.panel-switching .login-panel,
.panel-switching .signup-panel {
    animation: fadeOutLeft 0.3s ease;
}

.panel-switching .login-panel.active,
.panel-switching .signup-panel.active {
    animation: fadeInRight 0.3s ease;
}

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

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

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .modal-content {
        width: 100%;
        max-width: 100%;
    }

    .modal-body {
        padding: 30px 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .login-panel,
    .signup-panel {
        max-width: 480px;
        width: 100%;
        margin: 0 auto;
    }

    .login-panel h2,
    .signup-panel h1 {
        font-size: 28px;
        text-align: center;
    }

    .login-panel p,
    .signup-panel p {
        text-align: center;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"] {
        padding: 14px 16px;
        font-size: 14px;
        width: 100%;
        box-sizing: border-box;
    }

    .login-btn {
        padding: 14px 20px;
        font-size: 15px;
        width: 100%;
    }

    .terms-checkbox {
        text-align: left;
    }

    .forgot {
        display: block;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .modal-body {
        padding: 20px 15px;
    }

    .login-panel h2,
    .signup-panel h1 {
        font-size: 24px;
    }

    .login-panel p,
    .signup-panel p {
        font-size: 13px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"] {
        padding: 12px 14px;
        font-size: 14px;
        margin-bottom: 16px;
    }

    .login-btn {
        padding: 12px 18px;
        font-size: 14px;
    }

    .terms-checkbox {
        margin: 16px 0;
    }

    .terms-checkbox label {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px 15px;
    }

    .login-panel h2,
    .signup-panel h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .login-panel p,
    .signup-panel p {
        font-size: 12px;
        margin-bottom: 20px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"] {
        padding: 12px;
        font-size: 14px;
        margin-bottom: 14px;
        border-radius: 10px;
    }

    .login-btn {
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 10px;
    }

    .terms-checkbox {
        margin: 14px 0;
        gap: 8px;
    }

    .terms-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
        min-width: 16px;
    }

    .terms-checkbox label {
        font-size: 11px;
        line-height: 1.4;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .modal-lang-dropdown {
        margin-top: 15px;
    }
}

/* ===== Focus Ring Accessibility ===== */
*:focus-visible {
    outline: 2px solid #FF4B4B;
    outline-offset: 2px;
}

/* ===== Smooth Transitions ===== */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
