:root {
    --faculty-gradient-diagonal: linear-gradient(135deg, #00040b 0%, #2963bd 70%, #00040b 100%);
    --faculty-gradient-horizontal: linear-gradient(90deg, #00040b 0%, #2963bd 70%, #00040b 100%);
}

/* Page Header */
.page-header {
    background: var(--faculty-gradient-diagonal);
    color: white;
    padding: clamp(2.5rem, 6vw, 5rem) 1.25rem;
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
    box-shadow: 0 5px 25px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><rect fill="rgba(255,255,255,0.05)" width="50" height="50"/></svg>');
    background-size: 100px 100px;
    opacity: 0.3;
}

.page-title {
    font-size: clamp(1.6rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    text-shadow: 0 3px 10px rgba(0,0,0,0.3);
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.page-subtitle {
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    opacity: 0.95;
    position: relative;
    z-index: 1;
    font-weight: 500;
    line-height: 1.6;
}

.intro-box {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 0 auto;
}

.intro-title {
    font-size: 1.8rem;
    color: #1e3c72;
    margin-bottom: 15px;
    text-align: center;
}

.intro-text {
    font-size: 1.1rem;
    color: #555;
    text-align: center;
    line-height: 1.8;
}

/* Faculty Selection */
.faculty-selection {
    padding: clamp(1.5rem, 3vw, 2.5rem) 1rem 5rem;
    overflow-x: clip;
}

.section-title {
    font-size: clamp(1.35rem, 3vw, 2rem);
    color: #1e3c72;
    text-align: center;
    margin-bottom: clamp(1.25rem, 3vw, 2.5rem);
    font-weight: 600;
}

/* Faculty Grid - Responsive: 4 on desktop, 3 on tablet, 2 on small tablet, 1 on phone */
.faculty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: clamp(0.875rem, 2vw, 1.5rem);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 992px) {
    .faculty-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (min-width: 1400px) {
    .faculty-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 900px) {
    .faculty-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

/* Faculty Card - Compact Design */
.faculty-card {
    background: white;
    padding: 1.25rem 1rem;
    border-radius: 16px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.faculty-card-selectable {
    cursor: pointer;
    user-select: none;
}

.faculty-card-selectable:focus-within {
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.faculty-card-selectable .faculty-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.faculty-selection-check {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #cfd8dc;
    background: #ffffff;
    color: #1e3c72;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.faculty-card.is-selected .faculty-selection-check {
    opacity: 1;
    transform: scale(1);
    border-color: #1e3c72;
    background: #e3f2fd;
}

.faculty-card.is-selected {
    border-color: #1e3c72;
    box-shadow: 0 8px 24px rgba(30, 60, 114, 0.18);
}

.faculty-selection-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.faculty-selection-actions {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faculty-selection-hint {
    color: #4a4a4a;
    font-size: 1rem;
}

.faculty-selection-submit {
    align-self: center;
    background: #1e3c72;
    color: #ffffff;
    border: none;
    padding: 0.875rem 2rem;
    min-height: 48px;
    min-width: min(100%, 280px);
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.faculty-selection-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.faculty-selection-submit:not(:disabled):hover {
    background: #16305a;
    transform: translateY(-1px);
}

.faculty-selection-error {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 0 auto 16px;
    max-width: 600px;
    text-align: center;
}

.faculty-selection-error-message {
    color: #b71c1c;
    min-height: 1.25rem;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .faculty-card {
        padding: 18px 16px;
        min-height: 180px;
        border-radius: 14px;
    }
}

@media (max-width: 480px) {
    .faculty-card {
        padding: 20px 18px;
        min-height: 200px;
    }
}

.faculty-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--faculty-gradient-horizontal);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.faculty-card:hover::before {
    transform: scaleX(1);
}

@media (hover: hover) and (pointer: fine) {
    .faculty-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(102, 126, 234, 0.25);
        border-color: #764ba2;
    }
}

/* Faculty Icon - Compact Size */
.faculty-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .faculty-icon {
        font-size: 2.2rem;
        min-height: 60px;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .faculty-icon {
        font-size: 2.5rem;
        min-height: 70px;
        margin-bottom: 10px;
    }
}

/* Faculty Image - Compact Size */
.faculty-image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .faculty-image {
        width: 60px;
        height: 60px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .faculty-image {
        width: 70px;
        height: 70px;
        border-radius: 12px;
    }
}

.faculty-image.is-hidden {
    display: none;
}

.faculty-image:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.faculty-icon-fallback {
    font-size: 5rem;
    display: none;
}

.faculty-icon-fallback.is-visible {
    display: block;
}

.faculty-name {
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    font-weight: 700;
    background: var(--faculty-gradient-diagonal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
    line-height: 1.45;
    word-break: break-word;
    width: 100%;
}

@media (max-width: 768px) {
    .faculty-name {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }
}

@media (max-width: 480px) {
    .faculty-name {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
}

.faculty-code {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .faculty-code {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
}

.faculty-description {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 12px;
    flex-grow: 1;
}

@media (max-width: 768px) {
    .faculty-description {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
}

.faculty-arrow {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    background: var(--faculty-gradient-diagonal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    transition: all 0.3s ease;
}

.faculty-card:hover .faculty-arrow {
    opacity: 1;
    bottom: 10px;
}

@media (max-width: 768px) {
    .faculty-arrow {
        bottom: 10px;
        font-size: 1.2rem;
    }
    
    .faculty-card:hover .faculty-arrow {
        bottom: 8px;
    }
}

.no-faculties {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.2rem;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(0.75rem, 2vw, 1.25rem);
    width: 100%;
}

/* Live faculty selection enhancements */
.live-faculty-selection {
    overflow-x: clip;
}

.live-faculty-selection .intro-section {
    padding: 0 0 1rem;
}

.live-faculty-selection .intro-box {
    margin-bottom: 0.5rem;
}

.faculty-selection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto 1rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid rgba(30, 60, 114, 0.12);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.faculty-selection-count {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e3c72;
}

.faculty-selection-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.faculty-selection-tool-btn {
    background: #eef4fb;
    color: #1e3c72;
    border: 1px solid rgba(30, 60, 114, 0.15);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    min-height: 40px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.faculty-selection-tool-btn:hover {
    background: #e3f2fd;
    border-color: rgba(30, 60, 114, 0.28);
}

.live-faculty-selection .faculty-selection-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: linear-gradient(to top, #f5f5f5 75%, rgba(245, 245, 245, 0));
    padding: 1rem 0 0.5rem;
    margin-top: 0.5rem;
}

@media (min-width: 1400px) {
    .live-faculty-selection .page-title {
        font-size: 2.5rem;
    }

    .live-faculty-selection .faculty-card {
        min-height: 210px;
        padding: 1.5rem 1.25rem;
    }

    .live-faculty-selection .faculty-name {
        font-size: 1.2rem;
    }

    .live-faculty-selection .faculty-selection-submit {
        font-size: 1.05rem;
        min-height: 52px;
    }
}

@media (max-width: 560px) {
    .faculty-selection-toolbar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .faculty-selection-toolbar-actions {
        justify-content: center;
    }

    .live-faculty-selection .faculty-description {
        display: none;
    }

    .live-faculty-selection .faculty-card {
        min-height: 150px;
        padding: 1rem 0.875rem;
    }

    .live-faculty-selection .faculty-selection-actions {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }

    .faculty-selection-submit {
        width: 100%;
    }
}
