/* ============================================
   高考志愿填报系统 - 高级移动端样式
   ============================================ */

:root {
    --navy:        #1B2A4A;
    --navy-light:  #2D4A7A;
    --navy-lighter:#3A5A8C;
    --gold:        #C9A84C;
    --gold-light:  #E8D08A;
    --gold-dark:   #A8892E;
    --bg:          #F0F2F6;
    --card:        #FFFFFF;
    --text:        #1A1A2E;
    --text-light:  #6B7280;
    --text-lighter:#9CA3AF;
    --border:      #E5E7EB;
    --success:     #10B981;
    --danger:      #EF4444;
    --warning:     #F59E0B;
    --shadow:      0 2px 12px rgba(27, 42, 74, 0.08);
    --shadow-lg:   0 8px 30px rgba(27, 42, 74, 0.12);
    --radius:      12px;
    --radius-sm:   8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Header
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    padding: 12px 16px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 20px rgba(27, 42, 74, 0.3);
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), transparent);
    border-radius: 1px;
}

.header-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.header-title .gold {
    color: var(--gold);
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.header-btn:hover,
.header-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.header-btn-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--navy);
}

.header-btn-primary:hover,
.header-btn-primary:active {
    background: var(--gold-light);
    border-color: var(--gold-light);
}

.btn-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

/* ============================================
   Main Content
   ============================================ */

.main {
    padding-top: 64px;
    padding-bottom: 24px;
    min-height: 100vh;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ============================================
   Search Bar
   ============================================ */

.search-bar {
    margin: 16px 0;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--navy-light);
}

.search-bar .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-lighter);
    font-size: 16px;
}

/* ============================================
   Student Card
   ============================================ */

.student-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.student-card:active {
    transform: scale(0.98);
}

.student-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
    border-radius: 0 2px 2px 0;
}

.student-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.student-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy);
}

.student-badge {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(201, 168, 76, 0.12);
    color: var(--gold-dark);
    font-weight: 600;
    white-space: nowrap;
}

.student-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.student-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.student-info .label {
    color: var(--text-lighter);
}

.student-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-lighter);
}

.progress-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.progress-track {
    width: 60px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 2px;
    transition: width 0.3s;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-lighter);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
}

/* ============================================
   FAB
   ============================================ */

.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border: none;
    color: var(--navy);
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.4);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:active {
    transform: scale(0.92);
    box-shadow: 0 2px 10px rgba(201, 168, 76, 0.3);
}

/* ============================================
   Detail Page - Student Info
   ============================================ */

.info-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
    box-shadow: var(--shadow);
}

.info-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-card-title .time {
    font-size: 11px;
    color: var(--text-lighter);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
}

.form-input:focus {
    border-color: var(--navy-light);
    background: var(--card);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ============================================
   Choices List
   ============================================ */

.choices-section {
    margin-top: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-light);
}

.section-header .count {
    font-size: 12px;
    color: var(--text-lighter);
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 20px;
}

.choice-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: none;
}

.choice-card.sortable-ghost {
    opacity: 0.4;
    background: var(--border);
}

.choice-card.sortable-chosen {
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.choice-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-lighter);
    font-size: 16px;
    cursor: grab;
}

.choice-handle:active {
    cursor: grabbing;
}

.choice-number {
    position: absolute;
    left: 28px;
    top: 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-dark);
    background: rgba(201, 168, 76, 0.1);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.choice-body {
    margin-left: 54px;
}

.choice-school {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 2px;
}

.choice-major {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
}

.choice-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.choice-details .chip {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.choice-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.choice-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.choice-btn-edit {
    background: rgba(45, 74, 122, 0.08);
    color: var(--navy-light);
}

.choice-btn-edit:active {
    background: rgba(45, 74, 122, 0.15);
}

.choice-btn-delete {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

.choice-btn-delete:active {
    background: rgba(239, 68, 68, 0.15);
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    padding: 24px 20px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-cancel {
    background: var(--bg);
    color: var(--text-light);
}

.btn-cancel:active {
    background: var(--border);
}

.btn-confirm {
    background: var(--navy-light);
    color: #fff;
}

.btn-confirm:active {
    background: var(--navy);
}

/* ============================================
   Toast
   ============================================ */

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 300;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

/* ============================================
   Loading
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-lighter);
    font-size: 13px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 8px;
    border: 2px solid var(--border);
    border-top-color: var(--navy-light);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Confirm Dialog
   ============================================ */

.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-box {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    width: 280px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.confirm-box p {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 20px;
}

.confirm-box .confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-box .confirm-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================
   Print / PDF
   ============================================ */

@media print {
    .header, .fab, .choice-actions, .choice-btn, .header-actions,
    .modal-overlay, .confirm-overlay, .toast, .choice-handle,
    .btn-back, .search-bar {
        display: none !important;
    }

    .main {
        padding-top: 0;
    }

    .info-card, .choice-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .choice-number {
        position: static;
        display: inline-block;
        margin-right: 8px;
    }

    .choice-body {
        margin-left: 0;
    }

    body {
        background: #fff;
        font-size: 12px;
    }

    .container {
        max-width: 100%;
    }
}

/* ============================================
   Responsive Tweaks
   ============================================ */

@media (min-width: 480px) {
    .container {
        padding: 0 24px;
    }

    .modal-content {
        border-radius: var(--radius);
        margin-bottom: 40px;
    }

    .modal-overlay.active {
        align-items: center;
    }
}
