/**
 * TamilSource aMember Dark Theme
 * Based on WatchSunTV dark login design, adapted with TamilSource red (#e50914) accent
 */

/* === BASE === */
*, *::before, *::after { box-sizing: border-box; }

html { background: #0a0a0f !important; }

body {
    background: radial-gradient(ellipse at top, rgba(229,9,20,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at bottom right, rgba(100,100,255,0.04) 0%, transparent 50%),
                #0a0a0f !important;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    color: #ffffff;
    -webkit-font-smoothing: antialiased;
}

/* === HIDE DEFAULT AMEMBER CHROME === */
.am-header, .am-header-line, .am-footer { display: none !important; }

/* === LAYOUT === */
.am-layout {
    background: none !important;
    min-height: auto !important;
    margin: 0 !important;
    flex: none !important;
}

.am-body { background: none !important; }

.am-body-content-wrapper {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    max-width: 480px;
}

.am-body-content { min-height: auto !important; }
.am-body-content-top h1 { color: #fff !important; text-align: center !important; font-size: 22px !important; font-weight: 600 !important; margin-bottom: 24px !important; }

/* === LOGIN PAGE — CENTERED CARD === */
body.am-page-login {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    flex-direction: column !important;
}

body.am-page-login .am-layout {
    width: 100%;
    max-width: 420px;
}

body.am-page-login .am-body-content-top { display: none !important; }

body.am-page-login .am-login-form-wrapper,
body.am-page-login .am-sendpass-form-wrapper {
    max-width: 420px;
    margin: 0 auto !important;
    animation: fadeUp 0.6s ease-out;
}

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

/* === SIGNUP PAGE — WIDER CARD === */
body.am-page-signup {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 40px 20px !important;
    flex-direction: column !important;
}

body.am-page-signup .am-layout {
    width: 100%;
    max-width: 760px;
    margin: 0 auto !important;
}

body.am-page-signup .am-body-content-wrapper {
    max-width: 760px;
}

/* === MEMBER PAGES — WIDER === */
body.am-page-member .am-body-content-wrapper {
    max-width: 900px;
}

/* === CARD STYLE (forms) === */
.am-auth-form form,
.am-form form,
.am-signup form {
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 20px !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: none !important;
    overflow: visible !important;
    padding: 40px !important;
}

fieldset {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* === LEGEND / TITLES === */
.am-auth-form form legend,
.am-form form legend,
.am-signup form legend {
    background: transparent !important;
    border: none !important;
    font-size: 24px !important;
    font-weight: 600 !important;
    text-align: center !important;
    padding: 0 0 8px 0 !important;
    margin-bottom: 0 !important;
    background-image: linear-gradient(135deg, #fff 0%, #ccc 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    color: transparent !important;
    width: 100% !important;
}

/* === LOGO + SUBTITLE (injected by JS on login page) === */
.login-logo-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo-wrapper img {
    max-width: 200px;
    max-height: 100px;
    width: auto;
    height: auto;
    border-radius: 12px;
    object-fit: contain;
}

.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: #a0a0a0;
    margin-bottom: 32px;
}

/* === FORM ROWS === */
.am-auth-form div.am-row,
.am-form div.am-row,
.am-signup div.am-row {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
}

.am-auth-form div.am-row-buttons,
.am-form div.am-row-buttons {
    margin-bottom: 0 !important;
    margin-top: 8px !important;
}

/* === LABELS — override aMember's 35% float layout === */
.am-form div.am-element-title,
div.am-element-title,
.am-element-title,
.am-element-title label,
label.am-element-title {
    color: #a0a0a0 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    margin-bottom: 8px !important;
    padding: 0 !important;
    float: none !important;
    width: 100% !important;
    text-align: left !important;
    display: block !important;
}

/* Login page: hide labels (icons replace them) */
body.am-page-login .am-auth-form div.am-row div.am-element-title { display: none !important; }

/* === ELEMENT WRAPPER — override aMember's margin-left: 35% (inside same media query) === */
.am-form div.am-element,
div.am-element,
.am-element {
    padding: 0 !important;
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    margin-left: 0 !important;
}

@media all and (min-width: 500px) {
    .am-form div.am-element-title {
        width: 100% !important;
        float: none !important;
        text-align: left !important;
        padding: 0 !important;
    }
    .am-form div.am-element {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        float: none !important;
    }
}

/* Group elements (e.g. First + Last name side by side) */
.am-form div.am-element.group,
div.am-element.group,
.am-element.group {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
}

.am-element.group input[type="text"],
.am-form div.am-element.group input[type="text"] {
    flex: 1 !important;
    min-width: 0 !important;
    width: auto !important;
}

/* Description text / comments */
.am-form div.am-element-title .comment,
.am-element-title .comment,
.comment {
    color: #999 !important;
    font-size: 13px !important;
    margin-top: 4px !important;
    font-weight: 400 !important;
    text-align: left !important;
}

/* Payment system */
.am-paysystem-title {
    color: #fff !important;
    font-weight: 500 !important;
}

.am-paysystem-desc {
    color: #999 !important;
    font-size: 13px !important;
}

/* Product items */
.am-product-title { color: #fff !important; font-weight: 500 !important; }
.am-product-terms { color: #b3b3b3 !important; }
.am-product-desc { color: #999 !important; font-size: 13px !important; }

/* All general text must be visible on dark bg */
.am-body-content-content,
.am-body-content-content p,
.am-body-content-content span,
.am-body-content-content div,
.am-body-content-content li,
.am-form span,
.am-form div,
.am-form p,
.am-form label,
.am-login-text,
.am-signup-link,
.am-signup span,
.am-signup div,
.am-signup p {
    color: #b3b3b3 !important;
}

.am-login-text a,
.am-signup-link a {
    color: #e50914 !important;
    font-weight: 600 !important;
}

/* Override for titles/headings that should be white */
.am-form legend,
.am-form h1, .am-form h2, .am-form h3,
.am-element-title label,
.am-product-title,
.am-paysystem-title {
    color: #fff !important;
}

/* Login page: icon positioning */
body.am-page-login .am-auth-form .am-row-login-login .am-element,
body.am-page-login .am-auth-form .am-row-login-pass .am-element,
body.am-page-login .am-auth-form .am-row-sendpass-email .am-element {
    position: relative !important;
}

.am-auth-form { max-width: none !important; }

/* === INPUT FIELDS === */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100% !important;
    padding: 14px 16px !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    color: #ffffff !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    transition: all 0.2s !important;
    outline: none !important;
}

/* Login page inputs have left padding for icons */
body.am-page-login .am-auth-form input[type="text"],
body.am-page-login .am-auth-form input[type="password"],
body.am-page-login .am-auth-form input[type="email"] {
    padding-left: 48px !important;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.2) !important;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    background: rgba(255,255,255,0.1) !important;
    border-color: #e50914 !important;
    box-shadow: 0 0 0 3px rgba(229,9,20,0.3) !important;
}

input::placeholder { color: #666 !important; }

select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    padding-right: 40px !important;
}

select option { background: #1a1a1a; color: #fff; }

/* === INPUT ICONS (login page, injected by JS) === */
.input-icon-svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
    transition: color 0.2s;
    z-index: 2;
}

.am-element:focus-within .input-icon-svg { color: #e50914; }

/* === SUBMIT BUTTON === */
input[type="submit"],
button[type="submit"] {
    width: 100% !important;
    padding: 16px 24px !important;
    background: linear-gradient(135deg, #e50914 0%, #b20710 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    letter-spacing: 0.02em;
}

input[type="submit"]:hover,
button[type="submit"]:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 24px rgba(229,9,20,0.3) !important;
}

input[type="submit"]:active,
button[type="submit"]:active {
    transform: translateY(0) !important;
}

/* === LINKS === */
a { color: #e50914 !important; text-decoration: none !important; transition: color 0.2s !important; }
a:hover { color: #ff3344 !important; }

/* === INFO BOX === */
.am-info {
    background: rgba(229,9,20,0.1) !important;
    border: 1px solid rgba(229,9,20,0.3) !important;
    border-radius: 12px !important;
    color: #fff !important;
    padding: 16px !important;
    margin-bottom: 24px !important;
}

.am-info a { color: #e50914 !important; font-weight: 600 !important; }

/* === PRODUCT ITEMS (signup) === */
.am-product-title { color: #fff !important; font-weight: 500 !important; }
.am-product-terms { color: #a0a0a0 !important; }
.am-product-desc { color: #666 !important; font-size: 0.9rem !important; }

/* === CUSTOM FOOTER (login page, injected by JS) === */
.login-custom-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.login-custom-footer-text { font-size: 13px; color: #666; }

.login-custom-footer-links { margin-top: 12px; font-size: 13px; }
.login-custom-footer-links a { color: #e50914 !important; }
.login-custom-footer-links a:hover { color: #ff3344 !important; }

/* Hide default signup/forgot links — custom footer replaces them */
body.am-page-login .am-signup-link { display: none !important; }
body.am-page-login .am-form-login-switch-wrapper { display: none !important; }

/* === RECAPTCHA === */
.am-row-recaptcha {
    display: flex !important;
    justify-content: center !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
}

.am-row-recaptcha .am-element {
    display: flex !important;
    justify-content: center !important;
    padding: 0 !important;
}

/* === ERRORS === */
.am-errors,
ul.am-errors,
div.am-errors ul {
    background: rgba(255,71,87,0.1) !important;
    border: 1px solid rgba(255,71,87,0.3) !important;
    border-radius: 12px !important;
    color: #ff4757 !important;
    padding: 14px 16px !important;
    margin: 0 0 24px 0 !important;
    list-style: none !important;
    font-size: 14px !important;
}

.am-errors li { color: #ff4757 !important; }

/* === FLASH OVERLAY === */
.am-flash-content {
    background: #1a1a24 !important;
    color: #e0e0e0 !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 12px !important;
}

.am-flash-mask { background: rgba(0,0,0,0.7) !important; }

/* === PASSWORD TOGGLE === */
.am-pass-reveal-toggle { color: #666 !important; }
.am-pass-reveal-toggle:hover { color: #e50914 !important; }

/* === FORGOT PASSWORD FORM === */
.am-sendpass-form .am-row-sendpass-notice .am-element {
    color: #a0a0a0 !important;
    font-size: 14px !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
}

/* === REQUIRED ASTERISK === */
.required { color: #e50914 !important; }

/* === TABLES (member area) === */
table { width: 100% !important; border-collapse: collapse !important; }
th { background: rgba(255,255,255,0.05) !important; color: #fff !important; padding: 12px !important; text-align: left !important; }
td { padding: 12px !important; border-bottom: 1px solid rgba(255,255,255,0.05) !important; color: #b3b3b3 !important; }

/* === CHECKBOX / RADIO === */
input[type="checkbox"], input[type="radio"] {
    width: auto !important;
    padding: 0 !important;
    accent-color: #e50914;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .am-auth-form form,
    .am-form form,
    .am-signup form {
        padding: 28px 24px !important;
        border-radius: 16px !important;
    }

    .am-auth-form form legend { font-size: 20px !important; }

    .login-logo-wrapper img {
        max-width: 160px;
        max-height: 80px;
    }
}
