:root {
    --vh: 1vh;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

input,
textarea {
    -webkit-user-select: text;
    user-select: text;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    padding: 0;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    position: relative;
}

.top-banner-container {
    width: 100%;
    background: #f8f9fa;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    object-position: center;
}

.banner-container {
    width: 100%;
    background: #f8f9fa;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.banner-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.03) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    object-position: top;
    vertical-align: top;
}

.banner-image[src=""] {
    display: none;
}

.banner-container.hidden {
    display: none !important;
}

.form-container {
    padding: 30px 20px 40px;
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.form-title {
    font-size: 28px;
    color: #1a1a1a;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    padding-bottom: 15px;
}

.form-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-size: 15px;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.required {
    color: #ff4757;
    font-size: 16px;
    line-height: 1;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    background: #fafafa;
    color: #1a1a1a;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #999;
    font-size: 15px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.coupon-error {
    color: #ff4757;
    font-size: 14px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #fff5f5;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    animation: slideDown 0.3s ease-out;
}

.input-with-button {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-direction: column;
}

.input-with-button input {
    flex: 1;
}

.paste-btn {
    padding: 14px 24px;
    background: white;
    color: #333;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.paste-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.paste-btn:active::before {
    width: 300px;
    height: 300px;
}

.paste-btn:hover:not(:active) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
}

.paste-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    border: none;
}

@media (hover: none) {
    .paste-btn:hover {
        transform: none;
    }
}

.submit-btn {
    width: 100%;
    padding: 18px 24px;
    background: white;
    color: #333;
    border: 2px solid #e8e8e8;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.submit-btn:active::before {
    width: 400px;
    height: 400px;
}

.submit-btn:hover:not(:active):not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #d0d0d0;
}

.submit-btn:active:not(:disabled) {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.submit-btn:disabled {
    background: #f5f5f5;
    color: #999;
    border-color: #e0e0e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.8;
}

@media (hover: none) {
    .submit-btn:hover {
        transform: none;
    }
}

.message {
    padding: 16px 20px;
    margin: 20px;
    border-radius: 12px;
    font-size: 15px;
    text-align: center;
    display: none;
    animation: slideDown 0.3s ease-out;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

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

.message.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 2px solid #b8dacc;
    display: block;
    box-shadow: 0 4px 12px rgba(21, 87, 36, 0.1);
}

.message.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 2px solid #f1b0b7;
    display: block;
    box-shadow: 0 4px 12px rgba(114, 28, 36, 0.1);
}

/* 管理后台样式 */
.admin-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.admin-title {
    font-size: 28px;
    color: #333;
    font-weight: 600;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: white;
    color: #333;
    border: 2px solid #e8e8e8;
}

.btn-primary:hover {
    background: #f8f8f8;
    border-color: #d0d0d0;
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ee3742;
}

.btn-warning {
    background: #ffa502;
    color: white;
}

.btn-warning:hover {
    background: #e69400;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

tr:hover {
    background: #f8f9fa;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.qrcode-preview {
    text-align: center;
    margin-top: 20px;
}

.qrcode-preview img {
    max-width: 200px;
    border: 1px solid #e0e0e0;
    padding: 10px;
    background: white;
}

/* 移动端优化 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    .banner-container {
        min-height: 0;
    }

    .banner-image {
        width: 100%;
        height: auto;
    }

    .form-container {
        padding: 24px 16px 32px;
    }

    .form-title {
        font-size: 24px;
        margin-bottom: 24px;
    }

    .delivery-form {
        gap: 20px;
    }

    .form-group input,
    .form-group textarea {
        padding: 14px 16px;
        font-size: 16px; /* 防止iOS缩放 */
    }

    .input-with-button {
        flex-direction: column;
        gap: 12px;
    }

    .paste-btn {
        width: 100%;
        padding: 14px;
    }

    .submit-btn {
        padding: 16px 20px;
        font-size: 17px;
    }

    .message {
        margin: 16px;
        padding: 14px 18px;
        font-size: 14px;
    }

    /* 管理后台移动端样式 */
    .admin-container {
        margin: 0;
        padding: 16px;
        border-radius: 0;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .admin-title {
        font-size: 22px;
    }

    table {
        font-size: 13px;
    }

    th, td {
        padding: 10px 8px;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    .form-container {
        padding: 20px 14px 28px;
    }

    .form-title {
        font-size: 22px;
    }

    .form-group label {
        font-size: 14px;
    }

    .form-group input,
    .form-group textarea {
        padding: 13px 15px;
        border-radius: 10px;
    }

    .paste-btn,
    .submit-btn {
        border-radius: 10px;
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .banner-container {
        min-height: 0;
    }

    .banner-image {
        width: 100%;
        height: auto;
    }

    .form-container {
        padding: 20px 16px;
    }
}

/* 成功页面样式 */
.success-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(var(--vh, 1vh) * 100);
    padding: 40px 20px;
    background: #ffffff;
}

.success-page.hidden {
    display: none;
}

.success-content {
    text-align: center;
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 50px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.6s ease-out;
}

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

.success-title {
    font-size: 28px;
    color: #333;
    margin-bottom: 40px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.5px;
}

.success-image-container {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.success-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.success-text {
    font-size: 20px;
    color: #667eea;
    margin-top: 40px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* 成功页面移动端优化 */
@media (max-width: 768px) {
    .success-page {
        padding: 30px 16px;
    }

    .success-content {
        padding: 40px 24px;
        border-radius: 16px;
    }

    .success-title {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .success-text {
        font-size: 18px;
        margin-top: 30px;
    }
}

@media (max-width: 480px) {
    .success-content {
        padding: 30px 20px;
    }

    .success-title {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .success-text {
        font-size: 16px;
        margin-top: 25px;
    }
}
