/* Korea Rope Skipping Association - Authentication Clean UX */
:root {
    --auth-bg-color: transparent;
    /* Use theme's original background */
    --auth-card-bg: #ffffff;
    --auth-primary: #004b8d;
    --auth-primary-hover: #00376b;
    --auth-border: #e1e4e8;
    --auth-text: #333333;
    --auth-text-muted: #6c757d;
    --auth-input-bg: #ffffff;
    --auth-input-border: #ced4da;
    --auth-radius: 8px;
    --auth-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --auth-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --auth-readonly: #f8f9fa;
}

/* Global Reset for Auth Pages */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    background-color: var(--auth-bg-color);
    padding: 20px;
    font-family: 'Pretendard', 'Malgun Gothic', sans-serif;
}

.auth-card {
    background: var(--auth-card-bg);
    padding: 40px;
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--auth-border);
}

.auth-card.wide {
    max-width: 800px;
}

/* Typography */
.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    display: block;
    margin: 0 auto 15px;
    max-height: 60px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--auth-text);
    margin-bottom: 10px;
}

.auth-desc {
    font-size: 0.95rem;
    color: var(--auth-text-muted);
    line-height: 1.5;
}

/* Form Elements */
.auth-form .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.auth-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-text);
    margin-bottom: 8px;
}

.auth-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius);
    background-color: var(--auth-input-bg);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 141, 0.1);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius);
    background-color: var(--auth-input-bg);
}

.form-control::placeholder,
.auth-input::placeholder {
    font-size: 0.85rem !important;
    font-weight: 400;
    color: #adb5bd;
}

/* Force inputs to be light theme */
.auth-input,
.form-control,
.email-group select,
textarea.form-control {
    background-color: #ffffff !important;
    color: #333333 !important;
    border: 1px solid var(--auth-input-border);
}

.auth-input:read-only,
.form-control:read-only,
textarea.form-control:read-only {
    background-color: var(--auth-readonly) !important;
    color: #333333 !important;
    font-weight: 500;
    cursor: not-allowed;
    border-color: #e9ecef;
}

/* Generic Label Fix for Register Form */
.auth-card label {
    font-weight: 600;
    color: var(--auth-text);
    margin-bottom: 8px;
    display: block;
}

/* Fix browser autofill background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #333 !important;
}

/* Buttons */
.btn-auth {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--auth-radius);
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--auth-primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--auth-primary-hover);
}

/* Secondary Button Polish */
.btn-secondary {
    background-color: #fff;
    color: #495057;
    border: 1px solid #ced4da;
}

.btn-secondary:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

.btn-link {
    background: none;
    color: var(--auth-text-muted);
    padding: 0;
    font-size: 0.9rem;
    text-decoration: underline;
}

/* Utility */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

/* Checkbox Style */
.custom-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.custom-checkbox input {
    margin-right: 8px;
    transform: scale(1.2);
}

/* Registration Form Specifics */
.auth-card.wide .auth-form-wrap {
    padding: 20px 0;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--auth-text);
    border-bottom: 2px solid var(--auth-text);
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 25px;
    background: #fdfdfd;
    padding: 12px 15px;
    border-radius: 4px;
    border-left: 4px solid var(--auth-primary);
}

/* Validation Colors */
.is-valid {
    border-color: #28a745 !important;
    background-image: none;
}

.is-invalid {
    border-color: #dc3545 !important;
    background-image: none;
}

.validation-msg {
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.validation-msg.valid {
    color: #28a745;
    display: block;
}

.validation-msg.invalid {
    color: #dc3545;
    display: block;
}

/* Session Manager */
.session-manager {
    background: #ffffff;
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius);
    padding: 12px 15px;
    margin-top: 5px;
    margin-bottom: 20px;
}

.session-item {
    border-bottom: 1px solid #e9ecef;
    padding: 15px 0;
}

.session-item:last-child {
    border-bottom: none;
}

.session-device {
    color: var(--auth-text);
    font-weight: bold;
}

.session-meta {
    color: var(--auth-text-muted);
    font-size: 0.85rem;
}

.btn-session-del {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    color: #495057;
    cursor: pointer;
}

.btn-session-del:hover {
    background: #f8f9fa;
}

/* Layout Helpers for Form Rows */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.col-half {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 10px;
    box-sizing: border-box;
}

.col-full {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 10px;
}

/* Email Group */
.email-group {
    display: flex;
    align-items: center;
}

.email-group input {
    flex: 1;
}

.email-group select {
    flex: 0 0 150px;
    margin-left: 10px;
    height: 48px !important;
    padding: 0 30px 0 12px !important;
    /* Fixed clipping by removing vertical padding */
    line-height: normal !important;
    background-position: right 8px center !important;
    font-size: 14px;
}

/* Address Group */
.address-group {
    display: flex;
    flex-direction: column;
}

/* Optional Details */
details.optional-fields summary {
    padding: 10px 15px;
    border-radius: var(--auth-radius);
    cursor: pointer;
    font-weight: 600;
    outline: none;
}

details.optional-fields[open] summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.details-content {
    padding: 20px;
    border-bottom-left-radius: var(--auth-radius);
    border-bottom-right-radius: var(--auth-radius);
}

/* Agreement Section Styles */
.agreement-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.agreement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed #dee2e6;
}

.agreement-item:last-child {
    border-bottom: none;
}

.agreement-title {
    font-size: 0.95rem;
    color: var(--auth-text);
}

.agreement-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 12px;
    vertical-align: middle;
    line-height: 1;
    letter-spacing: -0.5px;
}

.badge-required {
    background-color: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.badge-optional {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.agreement-view-btn {
    font-size: 0.8rem;
    color: var(--auth-primary);
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

/* Terms Box Text Visibility */
.terms-box,
.terms-box *,
.details-content,
.details-content * {
    color: #333333 !important;
}

.terms-box {
    background-color: #f8f9fa !important;
}

.text-muted,
small,
.validation-msg,
.auth-desc {
    color: #555555 !important;
}

/* =========================================
   Social Login Styles (High Specificity)
   ========================================= */
#sns_login {
    margin: 30px 0 20px;
    text-align: center;
}

#sns_login h3 {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

#sns_login h3::before,
#sns_login h3::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e9ecef;
}

#sns_login h3::before {
    margin-right: 15px;
}

#sns_login h3::after {
    margin-left: 15px;
}

/* Wrapper - Force Flex Column */
.sns-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Buttons - Force Full Width Block */
#sns_login .sns-wrap a,
.sns-wrap .sns-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 50px !important;
    border-radius: 8px !important;
    position: relative !important;
    text-decoration: none !important;
    background-image: none !important;
    /* Remove any previous background images */
    margin-bottom: 0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    flex: none !important;
}

#sns_login .sns-wrap a:hover,
.sns-wrap .sns-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Icon Positioning */
#sns_login .sns-wrap a .ico,
.sns-wrap .sns-btn .ico {
    position: absolute !important;
    left: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 24px !important;
    height: 24px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    margin: 0 !important;
    display: block !important;
}

/* Text Styling */
#sns_login .sns-wrap a .txt,
.sns-wrap .sns-btn .txt {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding-left: 20px !important;
    /* Visual center adjustment */
    font-size: 15px !important;
    font-weight: 600 !important;
    color: inherit !important;
    visibility: visible !important;
    line-height: normal !important;
    height: auto !important;
}

/* Provider Colors */
.sns-naver {
    background-color: #03c75a !important;
    border: 1px solid #03c75a !important;
    color: #fff !important;
}

.sns-naver .ico {
    background-image: url('https://static.nid.naver.com/oauth/small_w_in.PNG') !important;
}

.sns-kakao {
    background-color: #fee500 !important;
    border: 1px solid #fee500 !important;
    color: #191919 !important;
}

.sns-kakao .ico {
    background-image: url('https://developers.kakao.com/tool/resource/static/img/button/kakaolink/kakaolink_btn_small.png') !important;
}

.sns-google {
    background-color: #ffffff !important;
    border: 1px solid #dadce0 !important;
    color: #3c4043 !important;
}

.sns-google .ico {
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg') !important;
}

/* Agree All Section */
.agree-all-wrap {
    background: #f8fbff;
    border: 1px solid #004b8d;
    padding: 12px 20px !important;
    /* Even smaller padding */
    border-radius: 8px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.agree-all-wrap:hover {
    background: #f0f7ff;
}

.agree-all-wrap.custom-control {
    padding-left: 55px !important;
    /* Ample space for the checkbox */
}

.agree-all-wrap .custom-control-label {
    padding-left: 8px !important;
    line-height: 1.5 !important;
    color: #004b8d;
    font-weight: 700;
    font-size: 14px;
    /* Even smaller font */
    cursor: pointer;
}

/* Fix checkbox positioning in Agree All wrap */
.agree-all-wrap .custom-control-label::before,
.agree-all-wrap .custom-control-label::after {
    left: -35px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 22px !important;
    height: 22px !important;
}

/* Smaller Icons for Profile Page List */
.sns-icon-sm {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
    background-size: contain;
    background-repeat: no-repeat;
    border-radius: 3px;
}

.sns-icon-sm.sns-naver {
    background-image: url('https://static.nid.naver.com/oauth/small_w_in.PNG');
    background-color: #03c75a;
}

.sns-icon-sm.sns-kakao {
    background-image: url('https://developers.kakao.com/tool/resource/static/img/button/kakaolink/kakaolink_btn_small.png');
    background-color: #fee500;
}

.sns-icon-sm.sns-google {
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg');
    background-color: #fff;
    border: 1px solid #ddd;
}


/* =========================================
   Mobile Responsive Fixes
   ========================================= */
@media (max-width: 768px) {
    .auth-card {
        padding: 30px 20px !important;
        max-width: 480px !important;
        /* Tablet optimized width */
        width: 90% !important;
        margin: 40px auto;
        border: 1px solid var(--auth-border) !important;
        box-shadow: var(--auth-shadow-lg) !important;
        background: var(--auth-card-bg);
    }

    .auth-wrapper {
        padding: 20px !important;
        background: transparent !important;
        align-items: center !important;
    }

    .col-half {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    /* Button Stack Fix */
    .btn-auth-group {
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 12px !important;
        width: 100% !important;
        align-items: stretch !important;
    }

    .btn-auth-group .btn {
        width: 100% !important;
        height: 54px !important;
        margin: 0 !important;
        flex: none !important;
    }

    .sns-wrap {
        width: 100% !important;
    }

    .email-group {
        flex-wrap: wrap;
    }

    .email-group input {
        flex: 0 0 100% !important;
        margin-bottom: 8px;
    }

    .email-group span {
        display: none;
    }

    .email-group select {
        flex: 0 0 100% !important;
        margin-left: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 576px) {
    .agree-all-wrap .custom-control-label {
        white-space: normal;
        word-break: keep-all;
    }
}