@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Manrope:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Manrope', sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: #000;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #666;
    margin-bottom: 3rem;
    font-size: 1rem;
    font-weight: 400;
}

.input-section {
    background: #fafafa;
    padding: 2rem;
    border-radius: 24px;
    border: 1px solid #e0e0e0;
    margin-bottom: 3rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    resize: vertical;
    margin-bottom: 1rem;
    background: #fff;
}

textarea:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 1px #000;
}

textarea::placeholder {
    color: #999;
}

button {
    background: #000;
    color: #fff;
    border: 1px solid #000;
    padding: 0.875rem 2rem;
    font-size: 0.9rem;
    font-family: 'Manrope', sans-serif;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background: #fff;
    color: #000;
}

button:disabled {
    background: #ccc;
    border-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

.input-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.history-btn {
    background: #fff;
    color: #000;
    border: 1px solid #000;
}

.history-btn:hover {
    background: #000;
    color: #fff;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 24px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
}

.modal-fullscreen {
    max-width: 95%;
    width: 95%;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 400;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #000;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #666;
    background: none;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.history-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    margin-bottom: 0.75rem;
    background: #fff;
    font-size: 0.9rem;
    color: #000;
    line-height: 1.6;
    transition: all 0.2s ease;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item:hover {
    border-color: #000;
    background: #fafafa;
}

.history-empty {
    padding: 3rem;
    color: #999;
    font-size: 1rem;
    text-align: center;
}

.loading {
    text-align: center;
    padding: 4rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fff;
    color: #c00;
    padding: 1.25rem;
    border: 1px solid #c00;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.hidden {
    display: none;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.results-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 400;
}

#time-display {
    font-family: 'Manrope', sans-serif;
    font-weight: 400;
    color: #666;
    font-size: 0.9rem;
}

#download-btn {
    background: #fff;
    color: #000;
    border: 1px solid #000;
}

#download-btn:hover {
    background: #000;
    color: #fff;
}

.three-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 1.5rem;
}

.column {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 1.5rem;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.column-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    font-weight: 400;
    margin: 0;
}

.expand-btn {
    background: none;
    border: 1px solid #e0e0e0;
    color: #666;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 50px;
    cursor: pointer;
}

.expand-btn:hover {
    border-color: #000;
    color: #000;
    background: none;
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scrollable {
    max-height: 70vh;
    overflow-y: auto;
}

.applicant-card {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 1.25rem;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    transition: border-color 0.2s ease;
}

.applicant-card:hover {
    border-color: #000;
}

.rank-badge {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.rank-badge.top {
    background: #000;
    -webkit-text-stroke-width: 0;
}

.rank-badge.bottom {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.applicant-info {
    flex: 1;
    min-width: 0;
}

.applicant-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #000;
}

.applicant-field {
    margin-bottom: 0.5rem;
}

.applicant-field:last-child {
    margin-bottom: 0;
}

.field-label {
    font-weight: 500;
    color: #888;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}

.field-content {
    font-size: 0.85rem;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

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

    .full-list-column {
        grid-column: span 2;
    }

    h1 {
        font-size: 2.5rem;
    }
}

/* --- Top bar --- */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.top-bar-left {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.top-bar-house {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
}

.top-bar-user {
    font-size: 0.85rem;
    color: #666;
}

.top-bar-logout {
    background: none;
    border: 1px solid #ccc;
    color: #666;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    border-radius: 50px;
}

.top-bar-logout:hover {
    border-color: #000;
    color: #000;
    background: none;
}

/* --- Login page --- */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #fff;
}

.login-box {
    width: 100%;
    max-width: 380px;
    padding: 2rem;
}

.login-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 2rem;
    text-align: center;
    color: #000;
}

.login-box input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    margin-bottom: 1rem;
    background: #fff;
}

.login-box input:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 1px #000;
}

.login-box button {
    width: 100%;
    margin-top: 0.5rem;
}

.login-box .error {
    margin-bottom: 1rem;
}

/* --- History metadata --- */

.history-meta {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.35rem;
}

.history-prompt {
    font-size: 0.9rem;
    color: #000;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .container {
        padding: 1.5rem 1rem;
    }

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

    .full-list-column {
        grid-column: span 1;
    }

    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    h1 {
        font-size: 2rem;
    }

    .input-row {
        flex-direction: column;
    }

    .input-row button {
        width: 100%;
    }
}
