/* Login Popup - Coolmate Inspired Design */
/* All styles scoped within #login-popup-overlay to prevent conflicts */

/* Header Account Link - Outside popup scope */
#open-login-popup {
    cursor: pointer;
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
    display: inline-flex;
    align-items: center;
}

#open-login-popup:hover {
    opacity: 0.8;
}

.header-account-title {
    cursor: pointer;
    position: relative;
    z-index: 10;
}

/* Logged in user - Red background with white icon */
.header-account-title.logged-in .header-account-icon,
.header-account-icon--logged-in {
    background-color: #c92c33 !important;
    border-radius: 50% !important;
    background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMCIgcj0iMyIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iOSIgc3Ryb2tlPSIjZmZmZmZmIi8+CjxwYXRoIGQ9Ik0xOCAxOC43MDU5QzE3LjY0NjEgMTcuNjQyNyAxNi44NjYyIDE2LjcwMzMgMTUuNzgxNCAxNi4wMzMyQzE0LjY5NjYgMTUuMzYzMiAxMy4zNjc0IDE1IDEyIDE1QzEwLjYzMjYgMTUgOS4zMDM0MSAxNS4zNjMyIDguMjE4NTggMTYuMDMzMkM3LjEzMzc1IDE2LjcwMzMgNi4zNTM5MSAxNy42NDI3IDYgMTguNzA1OSIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KPC9zdmc+Cg==) !important;
}

.header-account-title.logged-in:hover .header-account-icon,
.header-account-icon--logged-in:hover {
    background-color: #a82329 !important;
}

/* Body state when popup is open */
body.login-popup-open {
    overflow: hidden;
}

/* ========================================
   POPUP OVERLAY - Main Container
   ======================================== */
#login-popup-overlay {
    position: fixed !important;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999999 !important;
    display: none;
    align-items: flex-end;
    justify-content: center;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    pointer-events: none;
}

#login-popup-overlay.active {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

#login-popup-overlay.closing {
    opacity: 0;
}

/* ========================================
   ALL POPUP CONTENT - Scoped Styles
   ======================================== */

/* Container */
#login-popup-overlay .login-popup-container {
    position: relative;
    background: white;
    width: 100%;
    max-width: 100%;
    max-height: 90%;
    overflow-y: auto;
    border-radius: 12px 12px 0 0;
    padding: 24px;
    padding-bottom: 32px;
    animation: slideUp 0.5s ease-out;
    transition: transform 0.3s ease-in-out;
    z-index: 1000000 !important;
}

#login-popup-overlay.closing .login-popup-container {
    animation: slideDown 0.3s ease-in-out;
}

/* Close Button */
#login-popup-overlay .login-popup-close {
    position: absolute;
    right: 4px;
    top: 4px;
    z-index: 1000001 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #111;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

#login-popup-overlay .login-popup-close:hover {
    background: #1f2937;
}

#login-popup-overlay .login-popup-close:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#login-popup-overlay .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Content */
#login-popup-overlay .login-popup-content {
    color: #1f2937;
}

#login-popup-overlay .login-popup-logo {
    margin-bottom: 16px;
}

#login-popup-overlay .login-popup-logo img {
    height: auto;
    max-width: 100%;
}

#login-popup-overlay .login-popup-title {
    margin-top: 16px;
    margin-bottom: 0;
    font-size: 24px;
    font-weight: 500;
    line-height: 1.3;
    color: #111;
}

#login-popup-overlay .login-popup-subtitle {
    margin-top: 14px;
    margin-bottom: 0;
    font-size: 12px;
    color: #1f2937;
}

#login-popup-overlay .login-popup-subtitle b {
    font-weight: 600;
}

/* Benefits */
#login-popup-overlay .login-popup-benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 16px 0;
}

#login-popup-overlay .benefit-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#login-popup-overlay .benefit-item svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

#login-popup-overlay .benefit-text {
    flex: 1;
}

#login-popup-overlay .benefit-text p {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    color: #111;
    margin: 0;
}

/* Social Login */
#login-popup-overlay .login-popup-social-label {
    margin-top: 16px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    color: #111;
}

#login-popup-overlay .login-popup-social-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

#login-popup-overlay .social-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 6px;
    border: 1px solid #2563eb;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

#login-popup-overlay .social-login-btn:hover {
    background: #f3f4f6;
}

#login-popup-overlay .social-login-btn:active {
    background: #e5e7eb;
}

#login-popup-overlay .social-login-btn img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

/* Divider */
#login-popup-overlay .login-popup-divider {
    position: relative;
    height: 1px;
    background: rgba(17, 17, 17, 0.2);
    margin: 16px 0;
}

#login-popup-overlay .login-popup-divider span {
    position: absolute;
    top: 50%;
    left: 15%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0 8px;
    font-size: 12px;
    color: #111;
}

/* Form */
#login-popup-overlay .login-popup-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#login-popup-overlay .form-group-popup {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#login-popup-overlay .form-row-popup {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

#login-popup-overlay .input-wrapper {
    position: relative;
    margin-top: 10px;
}

#login-popup-overlay .form-input-popup {
    width: 100%;
    height: 45px;
    padding: 12px 24px;
    border: 1px solid #d1d5db;
    border-radius: 0;
    font-size: 16px;
    color: #1f2937;
    background: white;
    transition: border-color 0.2s;
    outline: none;
}

#login-popup-overlay .form-input-popup::placeholder {
    color: transparent;
}

#login-popup-overlay .form-input-popup:focus {
    border-color: #6b7280;
}

#login-popup-overlay .form-input-popup:hover:not(:disabled) {
    border-color: #6b7280;
}

#login-popup-overlay .form-input-popup:disabled {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #d1d5db;
    cursor: not-allowed;
}

#login-popup-overlay .form-input-popup.error {
    border-color: #dc2626;
}

/* Floating Label - Updated to match mhakimi style */
#login-popup-overlay .form-label-popup {
    position: absolute;
    left: 24px;
    top: 4px;
    color: #6b7280;
    font-size: 16px;
    font-weight: 400;
    background: white;
    padding: 0 8px;
    transform: translateY(-16px) scale(0.8);
    transform-origin: left;
    transition: all 0.3s;
    pointer-events: none;
    line-height: 1;
}

#login-popup-overlay .form-input-popup:placeholder-shown+.form-label-popup {
    position: absolute;
    left: 24px;
    top: 7px;
    color: #6b7280;
    font-size: 16px;
    font-weight: 400;
    background: white;
    padding: 0 8px;
    transform: translateY(-16px) scale(0.8);
    transform-origin: left;
    transition: all 0.3s;
    pointer-events: none;
    line-height: 1;
}

#login-popup-overlay .form-input-popup:focus+.form-label-popup {
    top: 4px;
    transform: translateY(-16px) scale(0.8);
    color: #6b7280;
    padding: 0 8px;
}

/* Toggle Password Button */
#login-popup-overlay .toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
}

#login-popup-overlay .toggle-password:focus {
    outline: none;
}

#login-popup-overlay .toggle-password:hover {
    color: #1f2937;
}

#login-popup-overlay .eye-icon {
    width: 16px;
    height: 16px;
}

#login-popup-overlay .eye-show {
    display: block;
}

#login-popup-overlay .eye-hide {
    display: none;
}

/* Error Message */
#login-popup-overlay .error-message {
    font-size: 14px;
    color: #dc2626;
    margin-top: 4px;
    display: none;
}

#login-popup-overlay .error-message.active {
    display: block;
}

/* Submit Button - Updated to match mhakimi style */
#login-popup-overlay .btn-submit-popup {
    font-family: SVN-Gilroy, sans-serif;
    width: 100%;
    height: 37px;
    padding: 8px 24px;
    border: none;
    background: #111;
    color: white;
    font-size: 14px;
    line-height: 24px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 8px;
}

#login-popup-overlay .btn-submit-popup:hover {
    background: #1f2937;
}

#login-popup-overlay .btn-submit-popup:active {
    background: #374151;
}

#login-popup-overlay .btn-submit-popup:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Footer */
#login-popup-overlay .login-popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 8px;
}

#login-popup-overlay .footer-link {
    position: relative;
    font-size: 12px;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

#login-popup-overlay .footer-link::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #2563eb;
    transition: width 0.2s;
}

#login-popup-overlay .footer-link:hover {
    color: #1d4ed8;
}

#login-popup-overlay .footer-link:hover::before {
    width: 100%;
}

#login-popup-overlay .footer-link:active {
    color: #1e40af;
}

/* Scrollbar styling */
#login-popup-overlay .login-popup-container::-webkit-scrollbar {
    width: 6px;
}

#login-popup-overlay .login-popup-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#login-popup-overlay .login-popup-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#login-popup-overlay .login-popup-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Hidden fields */
#login-popup-overlay #register-fields {
    display: none;
}

#login-popup-overlay #register-fields.show {
    display: block;
}

#login-popup-overlay #login-fields {
    display: block;
}

#login-popup-overlay #login-fields.hide {
    display: none;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    from {
        transform: scale(1);
        opacity: 1;
    }

    to {
        transform: scale(0.95);
        opacity: 0;
    }
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */
@media (max-width: 640px) {
    #login-popup-overlay .login-popup-container {
        padding: 20px;
        padding-bottom: 28px;
    }

    #login-popup-overlay .login-popup-title {
        font-size: 20px;
    }

    #login-popup-overlay .benefit-item {
        padding: 6px;
        gap: 6px;
    }

    #login-popup-overlay .benefit-item svg {
        width: 20px;
        height: 20px;
    }

    #login-popup-overlay .benefit-text p {
        font-size: 11px;
    }

    #login-popup-overlay .form-input-popup {
        height: 42px;
        font-size: 14px;
        padding: 10px 20px;
    }

    #login-popup-overlay .form-label-popup {
        font-size: 14px;
        left: 20px;
    }

    #login-popup-overlay .btn-submit-popup {
        height: 42px;
        font-size: 13px;
    }
}

/* ========================================
   RESPONSIVE - TABLET & DESKTOP
   ======================================== */
@media (min-width: 768px) {
    #login-popup-overlay .login-popup-title {
        font-size: 28px;
    }

    #login-popup-overlay .benefit-text p {
        font-size: 14px;
    }

    #login-popup-overlay .form-row-popup {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1024px) {
    #login-popup-overlay {
        align-items: center;
    }

    #login-popup-overlay .login-popup-container {
        max-width: 512px;
        border-radius: 12px;
        animation: zoomIn 0.2s ease-out;
    }

    #login-popup-overlay.closing .login-popup-container {
        animation: zoomOut 0.2s ease-out;
    }
}
