﻿/* ========================================
   Demographics Page - Modern Design
   Refactored Version
   ======================================== */

/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* === CSS VARIABLES === */
:root {
    /* Colors */
    --color-primary:        #202F5E;
    --color-accent:         #5F97FB;
    --color-text:           #445065;
    --color-text-muted:     #808897;
    --color-danger:         #FF4A4A;
    --color-border:         #808897;
    --color-bg:             #FFFFFF;
    --color-bg-subtle:      #F1F4FF;
    --color-hover-light:    rgba(95, 151, 251, 0.05);

    /* Layout */
    --header-height:        96px;
    --nav-width:            260px;
    --body-gap:             40px;
    --content-padding:      64px;
    --border-radius-input:  24px;
    --border-radius-card:   16px;

    /* Typography */
    --font-main:            'Montserrat', sans-serif;

    /* Shadows */
    --shadow-header:        0px 1px 5px 2px rgba(140, 142, 172, 0.25);
    --shadow-card:          0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-radio:         0px 2px 6px rgba(38, 43, 67, 0.14);

    /* Transitions */
    --transition-fast:      0.2s ease;
    --transition-base:      0.3s ease;
}


/* ========================================
   SITE HEADER
   ======================================== */

.site-header {
    background-color: var(--color-bg);
    padding: 8px 0;
    box-shadow: var(--shadow-header);
    width: 100%;
    max-height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80%;
    max-width: 100%;
    height: 80px;
    margin: 0 auto;
    padding: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 17px;
}

.logo-container img {
    width: 60px;
    height: 60px;
}

.header-title {
    font-size: clamp(16px, 1.8vw, 24px);
    font-weight: 500;
    color: var(--color-text);
}

.header-right {
    display: flex;
    align-items: center;
}

.header-nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    text-decoration: none;
    color: #353559;
    padding: 5px 0;
    transition: color var(--transition-base);
}

.nav-link:hover {
    color: var(--color-accent);
    text-decoration: none;
}

.nav-link.active {
    font-weight: 500;
    border-bottom: 2.2px solid var(--color-accent);
}

.nav-link i {
    font-size: 24px;
}


/* ========================================
   MAIN CONTAINER & HEADER WRAPPER
   ======================================== */

.demographics-container {
    min-height: 100vh;
    width: 100%;
}

.demographics-header-wrapper {
    width: 100%;
    max-width: 1352px;
    height: 280px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    background-color: transparent;
}

.header-contain-area {
    width: 100%;
    /* left-nav (260px) + body-gap (40px) + content-padding (64px) - wrapper-padding (20px) */
    padding-left: 344px;
}

.demographics-header-wrapper .page-title {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 40px;
    color: var(--color-text);
    margin: 0;
    line-height: 1.2;
    text-align: left;
}


/* ========================================
   BODY LAYOUT
   ======================================== */

.demographics-body {
    display: flex;
    width: 100%;
    max-width: 1352px;
    margin: 0 auto;
    gap: var(--body-gap);
}


/* ========================================
   LEFT NAVIGATION
   ======================================== */

.left-nav {
    width: var(--nav-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 20px);
    align-self: flex-start;
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
}

.left-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.left-nav li {
    margin-bottom: 8px;
    position: relative;
}

.left-nav li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--color-text);
    font-size: 20px;
    font-weight: 400;
    transition: background-color var(--transition-base);
}

.left-nav li:hover a {
    background-color: var(--color-hover-light);
}

.left-nav li.active {
    border-right: 4px solid var(--color-accent);
}

.left-nav li.active a {
    font-weight: 700;
    color: var(--color-accent);
}

.left-nav li.disabled a {
    color: #999;
    cursor: not-allowed;
}


/* ========================================
   CONTENT AREA
   ======================================== */

.content-area {
    flex-grow: 1;
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--color-bg);
    padding: var(--content-padding);
    border-radius: var(--border-radius-card);
    box-shadow: var(--shadow-card);
}

.content-area .page-subtitle {
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 40px;
    line-height: 1.6;
}


/* ========================================
   ALERT MESSAGES
   ======================================== */

.alert-danger {
    background-color: #FFE5E5;
    border: 1px solid var(--color-danger);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 32px;
    color: #D32F2F;
    font-size: 14px;
}


/* ========================================
   FORM SECTIONS
   ======================================== */

.form-section-card {
    margin-bottom: 50px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 32px;
}

.form-section-card:last-child {
    padding-bottom: 0;
}

.section-title {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 20px;
    color: var(--color-text);
    grid-column: 1 / -1;
    margin: 0 0 24px 0;
    padding: 0;
    border: none;
}

.section-subtitle {
    display: block;
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 14px;
    line-height: 100%;
    color: var(--color-text);
    margin: 0 0 8px 0;
    grid-column: 1 / -1;
}

.org-type-subtitle {
    margin-bottom: 16px;
    margin-top: 36px;
}

.page-subtitle {
    grid-column: 1 / -1;
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 24px;
}

.employment-status-label {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-text);
    margin-bottom: 24px;
    grid-column: 1 / -1;
    white-space: normal;
}

.section-block {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stacked-fields {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 32px;
}


/* ========================================
   FORM GROUPS & LABELS
   ======================================== */

.form-group-new label {
    display: block;
    font-size: 16px;
    color: var(--color-text);
    margin-bottom: 6px;
    font-weight: 400;
    line-height: 20px;
}

.form-group-new--spaced {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
}

.required-asterisk {
    color: var(--color-danger);
    margin-left: 4px;
}

.required-asterisk-tight {
    color: var(--color-danger);
    margin-left: 2px;
}


/* ========================================
   FORM CONTROLS
   ======================================== */

.form-control-new,
.form-group-new select,
.form-group-new input[type="text"],
.form-group-new input[type="email"],
.form-group-new input[type="number"] {
    display: block;
    width: 100%;
    max-width: 512px;
    height: 50px;
    box-sizing: border-box;
    padding: 0 24px;
    line-height: 48px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-input);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    margin: 0;
    outline: none;
    appearance: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-control-new:focus,
.form-group-new select:focus,
.form-group-new input[type="text"]:focus,
.form-group-new input[type="email"]:focus,
.form-group-new input[type="number"]:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(95, 151, 251, 0.1);
}

/* Error states */
.form-group-new.has-error .form-control-new,
.form-group-new.has-error select,
.form-group-new.has-error input[type="text"],
.form-group-new.has-error input[type="email"],
.form-group-new.has-error input[type="number"] {
    border-color: var(--color-danger);
}

.form-group-new.has-error label {
    color: var(--color-danger);
}

/* Dropdown arrow */
.form-group-new select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='14' height='8' viewBox='0 0 14 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L7 7L13 1' stroke='%23808897' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 24px center;
    padding-right: 56px;
}

.text-danger.field-validation-error {
    display: block;
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 6px;
}


/* ========================================
   RADIO BUTTONS
   ======================================== */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    position: relative;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.radio-option label {
    margin: 0;
    font-size: 16px;
    cursor: pointer;
    position: relative;
    color: var(--color-text);
    padding-left: 36px;
}

/* Unselected circle */
.radio-option label::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--color-border);
}

/* Selected circle */
.radio-option input[type="radio"]:checked + label::before {
    background: var(--color-bg);
    border: 6px solid var(--color-primary);
    box-shadow: var(--shadow-radio);
    width: 20px;
    height: 20px;
    left: 5px;
}

.radio-option input[type="radio"]:checked + label::after {
    display: none;
}


/* ========================================
   FORM ACTIONS & BUTTONS
   ======================================== */

.form-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    padding-top: 32px;
    border-top: 2px solid var(--color-bg-subtle);
}

.btn-primary-new {
    background-color: var(--color-primary);
    color: var(--color-bg);
    border: none;
    padding: 12px 32px;
    min-width: 120px;
    height: 50px;
    border-radius: var(--border-radius-input);
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.btn-primary-new:hover {
    background-color: #0f1a39;
}

.btn-secondary-new {
    background-color: #f0f0f0;
    color: var(--color-text);
    border: 1px solid #d0d0d0;
    padding: 12px 32px;
    min-width: 120px;
    height: 50px;
    border-radius: var(--border-radius-input);
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.btn-secondary-new:hover {
    background-color: #e0e0e0;
}


/* ========================================
   CUSTOM DROPDOWN
   ======================================== */

.custom-dropdown {
    position: relative;
    width: 100%;
    max-width: 512px;
}

.dropdown-button {
    width: 100%;
    height: 50px;
    padding: 16px 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-input);
    background-color: var(--color-bg);
    font-size: 14px;
    color: var(--color-text);
    font-family: var(--font-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    appearance: none;
    outline: none;
    transition: border-color var(--transition-fast);
}

.dropdown-button:hover,
.dropdown-button.open {
    border-color: var(--color-primary);
}

.dropdown-button.open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-border);
    transition: transform var(--transition-fast);
}

.dropdown-button.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-top: none;
    border-bottom-left-radius: var(--border-radius-input);
    border-bottom-right-radius: var(--border-radius-input);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), -4px -2px 8px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu::-webkit-scrollbar       { width: 8px; }
.dropdown-menu::-webkit-scrollbar-track { background: transparent; }
.dropdown-menu::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 4px;
}
.dropdown-menu::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

.dropdown-option {
    padding: 16px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.15s ease;
}

.dropdown-option.placeholder {
    cursor: default;
    background: transparent;
    color: var(--color-text-muted);
}

.dropdown-option-text.placeholder-text {
    color: var(--color-text-muted);
    font-weight: 400;
}

.dropdown-option:hover    { background-color: #f9f9f9; }
.dropdown-option.selected { background-color: #f5f5f5; }

.dropdown-option-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background-color: transparent;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.dropdown-option.selected .dropdown-option-circle {
    width: 15px;
    height: 15px;
    border: 5px solid var(--color-primary);
    background-color: white;
    box-shadow: 0 2px 6px rgba(32, 47, 94, 0.14);
}

.dropdown-option-text {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 400;
    font-family: var(--font-main);
}


/* ========================================
   HIDDEN SECTIONS (transition placeholders)
   ======================================== */

#Select_Employment,
#Select_Function,
#Select_Sector,
#Select_Business,
#Select_Academic {
    transition: opacity var(--transition-base), max-height var(--transition-base);
}


/* ========================================
   RESPONSIVE — TABLET (max 1024px)
   ======================================== */

@media (max-width: 1024px) {
    .content-area {
        padding: 40px 32px;
    }

    .page-title {
        font-size: 36px;
    }

    /* Left nav (260px) + gap (40px) + content padding (32px) - wrapper padding (20px) */
    .header-contain-area {
        padding-left: 312px;
    }
}


/* ========================================
   RESPONSIVE — MOBILE (max 768px)
   ======================================== */

@media (max-width: 768px) {
    /* Header */
    .site-header {
        display: unset;
    }

    .header-container {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .nav-link {
        font-size: 12px;
    }

    /* Page header */
    .demographics-header-wrapper {
        height: auto;
    }

    .demographics-header-wrapper .page-title {
        font-size: 28px;
    }

    /* content-area padding (24px) - wrapper padding (20px) */
    .header-contain-area {
        padding-left: 4px;
    }

    /* Body layout */
    .demographics-body {
        flex-direction: column;
        padding-bottom: 20px;
    }

    /* Left nav — horizontal scroll */
    .left-nav {
        width: 100%;
        margin-bottom: 24px;
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
        z-index: auto;
    }

    .left-nav ul {
        display: flex;
        overflow-x: auto;
        gap: 8px;
    }

    .left-nav li {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .left-nav li a {
        font-size: 14px;
        padding: 10px 10px;
    }

    .left-nav li.active {
        border-right: none;
        border-bottom: 4px solid var(--color-accent);
    }

    /* Content area */
    .content-area {
        padding: 5px;
    }

    /* Form controls */
    .form-group-new label {
        font-size: 12px;
    }

    .form-control-new,
    .form-group-new select,
    .form-group-new input[type="text"],
    .form-group-new input[type="email"],
    .form-group-new input[type="number"] {
        max-width: 300px;
        height: 30px;
        padding: 5px 15px;
        line-height: 28px;
    }

    .form-section-card {
        gap: 4px 10px;
    }

    /* Form actions */
    .form-actions {
        flex-direction: column-reverse;
        gap: 16px;
    }

    .btn-primary-new,
    .btn-secondary-new {
        width: 100%;
    }
}


/* ========================================
   RESPONSIVE — LARGE SCREENS (min 1300px)
   ======================================== */

@media (min-width: 1300px) {
    .header-title {
        font-size: 24px;
    }

    .header-container {
        width: 80%;
    }
}