/* style.css */

:root {
    --purple-dark: #660874;
    --purple: #82318E;
    --white: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    background: #f7f3fa;
    color: #333;

    min-height: 100vh;

    display: flex;
    flex-direction: column;
}

/* 顶栏 */

.topbar {
    height: 70px;
    background: var(--purple-dark);
    color: white;

    display: flex;
    align-items: center;

    padding: 0 20px;

    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;

    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.topbar h1 {
    margin-left: 15px;
    font-size: 24px;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
}

/* 侧边栏 */

.sidebar {
    position: fixed;
    top: 0;
    left: -260px;

    width: 260px;
    height: 100%;

    background: var(--purple);
    padding-top: 80px;

    transition: 0.3s;

    z-index: 1200;
}

.sidebar.active {
    left: 0;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
}

.sidebar a {
    color: white;
    text-decoration: none;

    padding: 18px 25px;

    transition: 0.3s;
}

.sidebar a:hover {
    background: rgba(255,255,255,0.15);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;

    background: none;
    border: none;

    color: white;
    font-size: 24px;

    cursor: pointer;
}

/* 遮罩 */

.overlay {
    position: fixed;
    inset: 0;

    background: rgba(0,0,0,0.4);

    opacity: 0;
    visibility: hidden;

    transition: 0.3s;

    z-index: 1100;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 主体 */

.main-content {
    padding-top: 90px;
    flex: 1;
}

/* 轮播图 */

.hero {
    width: 100%;
    overflow: hidden;
}

.slider {
    position: relative;
    height: 500px;
}

.slide {
    position: absolute;

    width: 100%;
    height: 100%;

    object-fit: cover;

    opacity: 0;
    transition: opacity 1s;
}

.slide.active {
    opacity: 1;
}

/* 欢迎 */

.welcome {
    padding: 60px 20px;
    text-align: center;
}

.welcome h2 {
    color: var(--purple-dark);
    font-size: 38px;
    margin-bottom: 20px;
}

.welcome p {
    max-width: 800px;
    margin: auto;
    line-height: 1.8;
    font-size: 18px;
}

/* 图片卡片 */

.gallery {
    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));

    gap: 25px;

    padding: 40px;
}

.card {
    background: white;

    border-radius: 18px;

    overflow: hidden;

    box-shadow: 0 5px 20px rgba(0,0,0,0.1);

    transition: 0.3s;
}

.card:hover {
    transform: translateY(-8px);
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.card h3 {
    padding: 20px;
    color: var(--purple-dark);
}

/* 页脚 */

.footer {
    background: var(--purple-dark);

    color: white;

    text-align: center;

    padding: 25px;
    margin-top: 40px;
}

/* 手机适配 */

@media (max-width: 768px) {

    .topbar h1 {
        font-size: 18px;
    }

    .slider {
        height: 260px;
    }

    .welcome h2 {
        font-size: 28px;
    }

    .welcome p {
        font-size: 16px;
    }

    .gallery {
        padding: 20px;
    }

}

/* 饭卡充值页面 */

.notice {

    background: white;

    margin: 30px auto;
    width: 90%;
    max-width: 900px;

    padding: 30px;

    border-left: 6px solid var(--purple-dark);

    border-radius: 16px;

    box-shadow: 0 5px 15px rgba(0,0,0,0.08);

}

.notice h2 {

    color: var(--purple-dark);
    margin-bottom: 15px;

}

.notice p {

    line-height: 1.8;

}

.recharge-box {

    background: white;

    width: 90%;
    max-width: 900px;

    margin: 30px auto;

    padding: 40px;

    border-radius: 20px;

    box-shadow: 0 5px 20px rgba(0,0,0,0.1);

}

.recharge-box h2 {

    text-align: center;

    color: var(--purple-dark);

    margin-bottom: 30px;

}

.student-input {

    width: 100%;

    padding: 16px;

    border: 2px solid #ddd;

    border-radius: 12px;

    font-size: 16px;

    margin-bottom: 30px;

    outline: none;

}

.student-input:focus {

    border-color: var(--purple);

}

.money-grid {

    display: grid;

    grid-template-columns:
    repeat(auto-fit, minmax(120px, 1fr));

    gap: 20px;

}

.money-btn {

    padding: 20px;

    border: none;

    border-radius: 16px;

    background: var(--purple);

    color: white;

    font-size: 22px;

    cursor: pointer;

    transition: 0.3s;

}

.money-btn:hover {

    background: var(--purple-dark);

    transform: translateY(-4px);

}

.submit-btn {

    width: 100%;

    margin-top: 35px;

    padding: 18px;

    border: none;

    border-radius: 14px;

    background: var(--purple-dark);

    color: white;

    font-size: 18px;

    cursor: pointer;

    transition: 0.3s;

}

.submit-btn:hover {

    opacity: 0.9;

}

@media (max-width: 768px) {

    .recharge-box {

        padding: 25px;

    }

}

/* ===== 公告弹窗 ===== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #fff;
    border-radius: 20px;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.35s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-header {
    background: var(--purple-dark);
    color: #fff;
    padding: 22px 30px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 20px 20px 0 0;
}

.modal-body {
    padding: 28px 30px 20px;
}

.modal-date {
    font-size: 14px;
    color: #e53935;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-body h3 {
    font-size: 18px;
    color: var(--purple-dark);
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal-body p {
    font-size: 15px;
    line-height: 1.9;
    color: #444;
    text-align: justify;
}

.modal-footer {
    padding: 0 30px 24px;
    text-align: center;
}

.modal-confirm {
    background: var(--purple-dark);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 13px 42px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.modal-confirm:hover {
    opacity: 0.88;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .modal-box {
        max-height: 80vh;
    }
    .modal-header {
        padding: 18px 20px;
        font-size: 17px;
    }
    .modal-body {
        padding: 20px;
    }
    .modal-body h3 {
        font-size: 16px;
    }
    .modal-body p {
        font-size: 14px;
    }
    .modal-footer {
        padding: 0 20px 20px;
    }
}

/* 随机优惠提示 */

.promo-tip {

    margin-top: 20px;
    padding: 14px 20px;

    background: linear-gradient(135deg, #fce4ec, #f3e5f5);
    border: 1px solid #e1bee7;
    border-radius: 12px;

    font-size: 16px;
    font-weight: 600;
    color: var(--purple-dark);

    text-align: center;

    animation: promoFadeIn 0.6s ease-out;
}

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

/* 自定义金额 */

.custom-amount {

    margin-top: 25px;
    padding: 20px;

    background: #faf5fc;
    border: 2px dashed #d5b0dc;
    border-radius: 14px;

}

.custom-amount label {

    display: block;

    font-size: 15px;
    color: #666;

    margin-bottom: 10px;

}

.custom-input-wrap {

    display: flex;
    align-items: center;

    background: white;

    border: 2px solid #ddd;
    border-radius: 12px;

    overflow: hidden;

    transition: border-color 0.3s;
}

.custom-input-wrap:focus-within {
    border-color: var(--purple);
}

.currency-sign {

    padding: 0 12px;

    font-size: 20px;
    font-weight: 700;
    color: var(--purple-dark);

    background: #f3eaf5;

    line-height: 48px;
}

.custom-input {

    flex: 1;

    border: none;
    outline: none;

    padding: 12px 14px;

    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.custom-input::-webkit-inner-spin-button,
.custom-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-input[type=number] {
    -moz-appearance: textfield;
}
