/* Imperial College DBA Application System — Custom Design Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(15, 23, 42, 0.08);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: rgba(15, 23, 42, 0.15);
    
    --primary: #0284c7;          /* Premium Blue Accent */
    --primary-hover: #0369a1;
    --gold: #d97706;             /* Academic Amber Accent */
    --gold-hover: #b45309;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #059669;          /* Valid state */
    --danger: #dc2626;           /* Invalid state */
    --shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.06);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-speed: 0.3s;
}

/* Reset and Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 60px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.container {
    width: 92%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 0;
}

/* Header & Typography */
header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

.logo-container {
    margin-bottom: 15px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-main), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 5px;
}

h2.section-heading {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gold);
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
    padding-bottom: 10px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Premium Card Layout */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 35px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    animation: fadeInUp 0.8s ease-out;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Part Steps Visual Progress Tracker */
.progress-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 15px;
    margin-bottom: 45px;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
    transition: all 0.3s ease;
}

.progress-track {
    position: absolute;
    left: 41px; /* 25px padding + 16px (half of 32px step circle) to align exactly with centers */
    right: 41px;
    top: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.progress-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(15, 23, 42, 0.08);
    z-index: 1;
    transform: translateY(-50%);
}

.progress-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 2px;
    background: var(--primary);
    z-index: 1;
    transform: translateY(-50%);
    transition: width 0.4s ease;
    width: 0%;
}

.progress-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid rgba(15, 23, 42, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
    cursor: pointer;
}

.progress-step:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.2);
}

.progress-step.active {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.25);
}

.progress-step.completed {
    border-color: var(--success);
    background: var(--success);
    color: #ffffff;
}

/* Form Styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

/* Inputs & Form Controls */
input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
    width: 100%;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Select specific styles */
select option {
    background: #ffffff;
    color: var(--text-main);
}

/* Date picker color adjustments */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Validation Classes (JS Driven) */
.form-group.success input,
.form-group.success select,
.form-group.success textarea {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15) !important;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15) !important;
    animation: shake 0.3s ease-in-out;
}

.validation-feedback {
    font-size: 0.75rem;
    margin-top: 5px;
    font-weight: 500;
    display: none;
}

.form-group.success .validation-feedback {
    color: var(--success);
    display: block;
}

.form-group.error .validation-feedback {
    color: var(--danger);
    display: block;
}

/* Custom Checkbox and Radio Styles */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 5px;
}

.option-item {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
}

.option-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox, .custom-radio {
    height: 20px;
    width: 20px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    margin-right: 12px;
    transition: all 0.2s ease;
    display: inline-block;
    flex-shrink: 0;
}

.custom-checkbox {
    border-radius: 4px;
}

.custom-radio {
    border-radius: 50%;
}

.option-item:hover input ~ .custom-checkbox,
.option-item:hover input ~ .custom-radio {
    border-color: var(--primary);
}

.option-item input:checked ~ .custom-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.option-item input:checked ~ .custom-radio {
    background: var(--primary);
    border-color: var(--primary);
}

/* Checkmark indicator inside custom check/radio */
.custom-checkbox::after, .custom-radio::after {
    content: '';
    display: none;
    position: relative;
}

.custom-checkbox::after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-radio::after {
    left: 5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
}

.option-item input:checked ~ .custom-checkbox::after,
.option-item input:checked ~ .custom-radio::after {
    display: block;
}

/* Dynamic Rows and Table Styling */
.dynamic-table-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.dynamic-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.dynamic-table th {
    background: rgba(15, 23, 42, 0.02);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.dynamic-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    vertical-align: middle;
}

.dynamic-table tr.dynamic-row {
    animation: fadeIn 0.4s ease-out;
}

.dynamic-table .form-group {
    margin-bottom: 0;
}

/* Dynamic Row inputs */
.dynamic-table input,
.dynamic-table select,
.dynamic-table textarea {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px 0 rgba(2, 132, 199, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(2, 132, 199, 0.3);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-hover) 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px 0 rgba(217, 119, 6, 0.2);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(217, 119, 6, 0.3);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.btn-secondary:hover {
    background: rgba(15, 23, 42, 0.10);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.25);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Conditional input fields styling */
.conditional-field {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease;
    opacity: 0;
    margin-top: 0;
}

.conditional-field.visible {
    max-height: 150px;
    opacity: 1;
    margin-top: 15px;
}

/* Terms and declaration styling */
.terms-box {
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 8px;
    padding: 20px;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.terms-list {
    list-style-type: decimal;
    padding-left: 20px;
}

.terms-list li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.declaration-list {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 20px;
}

.declaration-list li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.submit-container {
    text-align: center;
    margin-top: 40px;
}

/* Success Redirect Page Styling */
.success-container {
    text-align: center;
    max-width: 600px;
    margin: 10% auto 0;
}

.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 25px;
    animation: scaleUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.success-text {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.05rem;
}

/* Alert Notification Banner (Dynamic) */
.alert-banner {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.4s ease-out;
}

.alert-danger {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

/* Admin Dashboard Table */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.admin-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: rgba(15, 23, 42, 0.03);
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.admin-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    font-size: 0.95rem;
}

.admin-table tr:hover td {
    background: rgba(15, 23, 42, 0.02);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Detail View Layout styles */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.detail-item {
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid rgba(15, 23, 42, 0.04);
    border-radius: 8px;
    padding: 15px;
}

.detail-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-main);
    word-break: break-word;
}

.detail-item.full-width {
    grid-column: span 3;
}

/* Log-In Card specific spacing */
.login-card {
    max-width: 450px;
    margin: 8% auto 0;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Responsiveness Settings */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .card {
        padding: 20px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-item.full-width {
        grid-column: span 1;
    }
    
    .logo-text {
        font-size: 1.8rem;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* Document Upload & entry route layout styling */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    margin-top: 15px;
}

@media (min-width: 992px) {
    .upload-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .upload-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.upload-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upload-box:hover {
    border-color: rgba(212, 175, 55, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.upload-label {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.4;
}

.file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 25px 15px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all 0.2s ease;
    text-align: center;
    flex-grow: 1;
}

.file-dropzone:hover {
    background: rgba(212, 175, 55, 0.02);
    border-color: var(--primary);
}

.file-dropzone span {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.3;
}

.upload-icon {
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.file-dropzone:hover .upload-icon {
    color: var(--primary);
}

.file-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-color);
    animation: fadeIn 0.3s ease;
}

.file-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 85%;
}

.file-item-name::before {
    content: '📄';
}

.file-item-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    line-height: 1;
}

.file-item-remove:hover {
    color: #f87171;
}

