* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    color: #222;
    background: #f6f7f8;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: #fff;
    border-bottom: 1px solid #d9dde2;
}

.header-container {
    width: min(1180px, 92%);
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #222;
    text-decoration: none;
}

.brand-icon {
    width: 18px;
    height: 18px;
    border: 2px solid #333;
    border-radius: 3px;
}

.brand-role {
    margin-left: 3px;
    font-size: 10px;
    color: #777;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.main-nav a,
.main-nav .nav-button {
    color: #555;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    text-decoration: none;
}

.main-nav a:hover,
.main-nav .nav-button:hover,
.main-nav a.active {
    color: #111;
    text-decoration: none;
}

main {
    flex: 1;
}

.auth-wrapper {
    width: min(460px, 92%);
    margin: 55px auto;
}

.auth-card {
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid #d8dce1;
}

.auth-tab {
    padding: 15px;
    border: 0;
    background: #f1f2f3;
    font-size: 14px;
    cursor: pointer;
}

.auth-tab.active {
    background: #fff;
    font-weight: 600;
}

.auth-panel {
    padding: 28px 32px 32px;
}

.auth-panel h1 {
    margin: 0 0 6px;
    font-size: 21px;
}

.password-reset-panel .auth-return {
    margin: 24px 0 0;
}

.subtitle {
    margin: 0 0 24px;
    color: #666;
    font-size: 13px;
}

.hidden {
    display: none;
}

.form-group {
    margin-bottom: 17px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

input,
select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #c9ced4;
    border-radius: 3px;
    background: #fff;
    font: inherit;
    font-size: 14px;
}

input:focus,
select:focus {
    outline: 2px solid #aeb8c2;
    outline-offset: 1px;
}

.input-error {
    border-color: #b42318;
}

.field-error,
.form-error {
    margin: 5px 0 0;
    color: #b42318;
    font-size: 12px;
}

.field-error:empty,
.form-error:empty {
    display: none;
}

.field-hint {
    margin: 5px 0 0;
    color: #777;
    font-size: 11px;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.text-link {
    color: #555;
    font-size: 12px;
}

.form-notice {
    margin: 0 0 18px;
    padding: 10px 12px;
    border-left: 3px solid #2f7d4f;
    border-radius: 3px;
    background: #eef6f0;
    color: #1f5135;
    font-size: 13px;
    line-height: 1.5;
}

.form-notice:empty {
    display: none;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: #555;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

.link-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.primary-button {
    width: 100%;
    padding: 11px 15px;
    border: 0;
    border-radius: 3px;
    background: #333;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.primary-button:hover {
    background: #111;
}

.site-footer {
    min-height: 55px;
    padding: 0 4%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #d9dde2;
    background: #f0f1f2;
    color: #777;
    font-size: 11px;
}

@media (max-width: 650px) {
    .header-container {
        flex-wrap: wrap;
        gap: 8px 16px;
        padding: 12px 0;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 8px 16px;
    }

    .auth-wrapper {
        margin: 25px auto;
    }

    .auth-panel {
        padding: 24px 20px;
    }

    .name-grid {
        grid-template-columns: 1fr;
    }
}

/* Student Profile */

.profile-wrapper {
    width: min(1100px, 92%);
    margin: 40px auto 60px;
}

.profile-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 24px;
}

.profile-heading h1 {
    margin: 0 0 6px;
    font-size: 25px;
}

.profile-heading p {
    margin: 0;
    color: #666;
    font-size: 13px;
}

.profile-completion {
    min-width: 150px;
    text-align: right;
}

.profile-completion span {
    display: block;
    margin-bottom: 5px;
    color: #777;
    font-size: 10px;
    text-transform: uppercase;
}

.profile-completion strong {
    font-size: 18px;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 22px;
    align-items: start;
}

.profile-card {
    padding: 25px;
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
}

.profile-card h2 {
    margin: 0 0 22px;
    font-size: 17px;
}

textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #c9ced4;
    border-radius: 3px;
    resize: vertical;
    font: inherit;
    font-size: 14px;
}

textarea:focus {
    outline: 2px solid #aeb8c2;
    outline-offset: 1px;
}

.skill-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    align-items: start;
    gap: 8px;
    margin-top: 10px;
}

.skill-options > .loading-text {
    grid-column: 1 / -1;
    margin: 0;
    color: #666;
    font-size: 13px;
}

.skill-option {
    display: flex !important;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    padding: 7px 10px;
    border: 1px solid #c9ced4;
    border-radius: 4px;
    background: #f8f9fa;
    font-weight: normal !important;
    cursor: pointer;
}

.skill-option input {
    width: auto;
    margin: 0;
}

.skill-item {
    width: 100%;
}

.skill-elaboration-container {
    margin-top: 8px;
    margin-left: 0;
}

.skill-elaboration-container label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-size: 12px;
    font-weight: normal;
}

.skill-elaboration {
    width: 100%;
}

.hours-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.optional {
    color: #888;
    font-size: 11px;
    font-weight: normal;
}

.profile-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin-top: 20px;
}

.profile-save {
    width: auto;
    min-width: 140px;
}

.form-message {
    margin: 0;
    color: #666;
    font-size: 12px;
}

.profile-actions .form-message {
    font-size: 14px;
    line-height: 1.5;
}

.profile-actions .form-message.form-error {
    color: #b42318;
}

@media (max-width: 800px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-completion {
        text-align: left;
    }

    .hours-grid {
        grid-template-columns: 1fr;
    }
}

.name-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.nav-button {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.nav-button:disabled {
    cursor: default;
    opacity: 0.6;
}

[hidden] {
    display: none !important;
}

/* Student Dashboard */

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 24px;
    align-items: start;
}

.dashboard-results,
.dashboard-sidebar {
    min-width: 0;
}

.dashboard-results h2,
.dashboard-sidebar h2 {
    margin: 0 0 18px;
    font-size: 18px;
}

.dashboard-sidebar {
    padding: 24px;
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
}

.dashboard-sidebar .primary-button {
    margin-top: 4px;
}

.dashboard-clear {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 9px;
    background: #fff;
    border: 1px solid #c9ced4;
    border-radius: 3px;
    cursor: pointer;
}

.dashboard-clear:disabled,
.dashboard-sidebar .primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.internship-list {
    display: grid;
    gap: 14px;
}

.internship-card {
    padding: 22px;
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
}

.internship-card h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.internship-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #666;
    font-size: 12px;
}

.internship-meta span {
    padding: 5px 8px;
    background: #f1f2f3;
    border-radius: 3px;
}

.internship-description {
    margin: 15px 0;
    color: #555;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.internship-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.dashboard-button {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 3px;
    background: #333;
    color: #fff;
    font-size: 13px;
    text-decoration: none;
}

.dashboard-button:hover {
    background: #111;
}

#internship-status {
    padding: 20px;
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
    color: #555;
    font-size: 13px;
}

@media (max-width: 800px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        grid-row: 1;
    }
}

/* Internship Details */

.internship-details-wrapper {
    max-width: 960px;
}

.internship-back-link {
    display: inline-block;
    margin-bottom: 22px;
    color: #333;
    font-size: 13px;
    text-decoration: none;
}

.internship-back-link:hover {
    text-decoration: underline;
}

.internship-detail-card {
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
    padding: 30px;
}

.internship-detail-header h1 {
    margin: 0 0 16px;
    font-size: 26px;
}

.internship-detail-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e4e7ea;
}

.internship-detail-section h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.internship-detail-section p {
    color: #555;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.internship-detail-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 0;
}

.internship-detail-fields div {
    padding: 16px;
    background: #f6f7f8;
    border-radius: 4px;
}

.internship-detail-fields dt {
    margin-bottom: 8px;
    color: #666;
    font-size: 12px;
}

.internship-detail-fields dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

#internship-detail-status {
    padding: 22px;
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
    color: #555;
}

@media (max-width: 600px) {
    .internship-detail-card {
        padding: 20px;
    }

    .internship-detail-fields {
        grid-template-columns: 1fr;
    }

    .internship-detail-header h1 {
        font-size: 22px;
    }
}

/* Student applications, saved items and match scores */

.section-heading-row,
.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.section-heading-row h2 {
    margin: 0 0 14px;
}

.card-head h3 {
    margin: 0 0 12px;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.match-badge,
.status-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e6f0ff;
    color: #1d4a9a;
}

.status-badge {
    background: #eceef0;
    color: #444;
}

.status-submitted,
.status-applied { background: #e6f0ff; color: #1d4a9a; }
.status-under-review { background: #fff4d6; color: #7a5600; }
.status-interview-offered,
.status-accepted { background: #def5e3; color: #1c6b34; }
.status-rejected { background: #fde4e4; color: #9b1c1c; }
.status-withdrawn { background: #eceef0; color: #666; }

.match-total {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.match-total .match-badge {
    font-size: 20px;
    padding: 6px 14px;
}

.match-components {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.match-components li {
    padding: 14px;
    background: #f6f7f8;
    border-radius: 4px;
}

.match-component-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-explanation {
    margin: 8px 0 0;
    color: #555;
    font-size: 13px;
    line-height: 1.5;
}

.applications-section {
    margin-top: 28px;
}

.applications-section h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.list-status {
    padding: 20px;
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
    color: #555;
    font-size: 13px;
}

.internship-actions {
    gap: 10px;
}

#apply-form textarea {
    width: 100%;
    padding: 10px;
    font: inherit;
    border: 1px solid #c9ced4;
    border-radius: 3px;
}

#application-message,
#match-status {
    font-size: 13px;
}

@media (max-width: 600px) {
    .match-components {
        grid-template-columns: 1fr;
    }
}

.internship-actions .dashboard-clear,
.section-heading-row .dashboard-clear,
#application-result .dashboard-clear {
    display: inline-block;
    width: auto;
    margin-top: 0;
    padding: 10px 16px;
    font-size: 13px;
}

.application-live-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 28px;
    padding: 14px 20px;
    background: #fff;
    border: 1px solid #d8dce1;
    border-radius: 5px;
}

.application-live-bar .list-status {
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

.application-live-bar .form-message {
    order: 1;
    flex-basis: 100%;
}

.application-live-bar .dashboard-button {
    padding: 8px 14px;
    border: 1px solid #c9ced4;
    background: #fff;
    color: #333;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.application-live-bar .dashboard-button:hover {
    background: #f1f2f3;
}

.application-live-bar .form-message:empty {
    display: none;
}

.internship-card > .form-message {
    margin-top: 10px;
}

#application-result p {
    margin: 0 0 10px;
}

/* Standalone auth cards (password reset pages have no tabs or panels) */

.auth-card:not(:has(.auth-panel)) {
    padding: 30px 32px 26px;
}

.auth-card > h1 {
    margin: 0 0 8px;
    font-size: 21px;
}

.auth-card > h1 + p:not(.subtitle):not(.form-error) {
    margin: 0 0 20px;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.auth-card .subtitle {
    line-height: 1.5;
}

.auth-card p[role="status"] {
    margin: 0 0 18px;
    padding: 10px 12px;
    border-left: 3px solid #2f7d4f;
    border-radius: 3px;
    background: #eef6f0;
    color: #1f5135;
    font-size: 13px;
}

.auth-card .form-error[role="alert"] {
    margin-bottom: 14px;
    font-size: 13px;
}

.auth-card > .form-error + p {
    margin: 14px 0 0;
    font-size: 14px;
    font-weight: 600;
}

.auth-card .errorlist {
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-card form + p,
.auth-card > p:last-child {
    margin: 18px 0 0;
    text-align: center;
    font-size: 13px;
}

.auth-card > p > a {
    color: #333;
    text-underline-offset: 3px;
}

.auth-card > p > a:hover {
    color: #111;
}

@media (max-width: 650px) {
    .auth-card:not(:has(.auth-panel)) {
        padding: 24px 20px;
    }
}

/* Keyboard focus */

a:focus-visible,
button:focus-visible {
    outline: 2px solid #2c6db2;
    outline-offset: 2px;
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.form-group .field-hint + label {
    margin-top: 16px;
}

/* Profile polish */

.profile-card input[type="file"] {
    padding: 8px;
    background: #fafbfc;
    font-size: 13px;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    border: 1px solid #c9ced4;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
    background: #f1f2f3;
}

.skill-option:hover {
    border-color: #8d96a0;
    background: #fff;
}

.profile-card .field-hint a,
#download-cv {
    color: #333;
    font-size: 13px;
}

.profile-actions {
    padding-top: 18px;
    border-top: 1px solid #e4e7ea;
}

.profile-completion strong {
    color: #1c6b34;
}

.auth-tab:not(.active):hover {
    background: #e8eaec;
}

#skill-options {
    padding: 8px;
    border: 1px solid #e4e7ea;
    border-radius: 4px;
    background: #fff;
}
