/* ==================== CSS Variables ==================== */
:root {
    --primary-color: #b33939;
    /* Soft Light Maroon */
    --primary-dark: #8b2d2d;
    --primary-light: #d14d4d;
    --theme-teal: #64ffda;
    --theme-teal-dark: #008080;
    --theme-teal-dim: rgba(0, 128, 128, 0.1);
    --bg-teal-light: #e0f2f1;
    --secondary-color: #FFFFFF;
    /* White */
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
    --border-color: #E0E0E0;
    --success-color: #27AE60;
    --error-color: #E74C3C;
    --warning-color: #F39C12;
    --background: var(--bg-teal-light);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #E8E8E8 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== Container ==================== */
.public-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== Header ==================== */
.public-header {
    background: var(--theme-teal-dark);
    color: var(--secondary-color);
    padding: 30px;
    border-radius: 10px 10px 0 0;
    box-shadow: var(--shadow);
    border-bottom: 3px solid var(--theme-teal);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 80px;
    height: 80px;
    background: var(--secondary-color);
    border-radius: 10px;
    padding: 10px;
}

.header-text h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.header-text p {
    font-size: 14px;
    opacity: 0.9;
}

/* ==================== Form Container ==================== */
.form-container {
    background: var(--secondary-color);
    padding: 40px;
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow);
}

.form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.form-header h2 {
    color: var(--theme-teal-dark);
    font-size: 26px;
    margin-bottom: 10px;
}

.form-header p {
    color: var(--text-light);
    font-size: 14px;
}

/* ==================== Form Sections ==================== */
.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    color: var(--theme-teal-dark);
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--theme-teal-dim);
}

/* ==================== Form Rows & Groups ==================== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.required {
    color: var(--error-color);
}

.form-group input,
.form-group select {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #FAFAFA;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--theme-teal-dark);
    background: var(--secondary-color);
    box-shadow: 0 0 0 3px var(--theme-teal-dim);
}

/* ==================== Readonly Fields ==================== */
.form-group input[readonly] {
    background: #f8f9fa;
    border-color: #28a745;
    color: var(--text-dark);
    cursor: not-allowed;
    position: relative;
}

.form-group input[readonly]:focus {
    border-color: #28a745;
    background: #f8f9fa;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Auto-fill indicator */
.form-group input[readonly]::after {
    content: "🔒";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    font-size: 12px;
}

.auto-fill-note {
    color: #28a745 !important;
    font-size: 12px !important;
    margin-top: 5px !important;
    font-style: italic;
}

.auto-fill-note i {
    font-style: italic;
}

/* Loading state for student ID field */
.form-group input.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z' opacity='.25'/%3E%3Cpath fill='%23666' d='M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z'%3E%3CanimateTransform attributeName='transform' dur='0.75s' repeatCount='indefinite' type='rotate' values='0 12 12;360 12 12'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
}

/* Error state for inputs */
.form-group input.error {
    border-color: var(--error-color);
    background: #fdf2f2;
}

.form-group input.error:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Success state for auto-filled inputs */
.form-group input[readonly] {
    position: relative;
}

.form-group input[readonly]::before {
    content: "🔒";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    font-size: 12px;
    pointer-events: none;
}

/* Info alert styles */
.alert-info {
    background: #d1ecf1;
    border-left: 5px solid #17a2b8;
    color: #0c5460;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.form-group small {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 5px;
}

/* ==================== File Upload ==================== */
.file-upload-container {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #FAFAFA;
}

.file-upload-container:hover {
    border-color: var(--theme-teal-dark);
    background: var(--bg-teal-light);
}

.file-upload-container input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-label {
    pointer-events: none;
}

.file-upload-label svg {
    color: var(--theme-teal-dark);
    margin-bottom: 10px;
}

.file-upload-label p {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 5px;
}

.file-preview {
    margin-top: 15px;
    padding: 15px;
    background: #F0F0F0;
    border-radius: 5px;
    display: none;
}

.file-preview.active {
    display: block;
}

.file-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 5px;
    margin-top: 10px;
}

.file-preview p {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 5px;
}

/* ==================== Buttons ==================== */
.form-actions {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.btn-primary,
.btn-secondary {
    padding: 15px 40px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--secondary-color);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background: #CCC;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--secondary-color);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== Alerts ==================== */
.alert {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #D5F4E6;
    border-left: 5px solid var(--success-color);
    color: #155724;
}

.alert-error {
    background: #F8D7DA;
    border-left: 5px solid var(--error-color);
    color: #721C24;
}

.alert h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.tracking-info {
    background: var(--secondary-color);
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    text-align: center;
}

.tracking-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--theme-teal-dark);
    margin-top: 5px;
    letter-spacing: 1px;
}

.note {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 10px;
}

/* ==================== Footer ==================== */
.public-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 14px;
}

.public-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.public-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .public-container {
        padding: 10px;
    }

    .form-container {
        padding: 25px 20px;
    }

    .logo-section {
        flex-direction: column;
        text-align: center;
    }

    .header-text h1 {
        font-size: 22px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}