/* 基础样式重置 */
* {
    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-box-textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* CSS变量定义 */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --background: #f0f4f8;
    --text: #333;
    --card: #fff;
    --shadow: rgba(0, 0, 0, 0.1);
    --slider-bg: #f3f4f6;
    --slider-text: #666;
    --toast-bg: rgba(255, 255, 255, 0.98);
    --toast-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --animation-curve: cubic-bezier(0.34, 1.56, 0.64, 1);
    --admin-color: #8b5cf6;
    --admin-dark: #7c3aed;
}

/* 主题样式 */
body.dark {
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --background: #1f2937;
    --text: #f3f4f6;
    --card: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
    --slider-bg: #4b5563;
    --slider-text: #e5e7eb;
    --toast-bg: rgba(55, 65, 81, 0.98);
    --admin-color: #a78bfa;
    --admin-dark: #8b5cf6;
}

/* 基础布局 */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: var(--background);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    touch-action: manipulation;
    color: var(--text);
    transition: background-color 0.3s var(--animation-curve);
    overflow-x: hidden;
}

html {
    height: -webkit-fill-available;
}

/* 容器样式 */
.container {
    width: 100%;
    max-width: 500px;
    background: var(--card);
    border-radius: 16px;
    padding: min(25px, 5vw);
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s var(--animation-curve);
    margin: auto;
}

/* 车辆信息展示区域样式 */
.car-info-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
    padding: 30px 0;
}

/* 汽车图标样式 */
.car-icon {
    width: 64px;
    height: 36px;
    margin-bottom: 15px;
    display: block;
}

/* 车牌号样式 */
.license-plate {
    background: #28508e;
    color: white;
    font-size: 28px;
    font-weight: bold;
    padding: 10px 30px;
    border-radius: 5px;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

/* 温馨提示样式 */
.warm-tips {
    text-align: center;
}

.tip-text {
    color: #6a5acd;
    font-size: 18px;
    margin: 10px 0;
    font-weight: 500;
}

/* 标题样式 */
h1 {
    font-size: clamp(24px, 5vw, 28px);
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titlePulse 2s var(--animation-curve) infinite;
    will-change: transform;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 2px;
    animation: titleUnderline 2s var(--animation-curve) infinite;
}

/* 表单元素样式 */
.select-box {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--slider-bg);
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 15px;
    background: var(--card);
    color: var(--text);
    transition: all 0.3s var(--animation-curve);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.select-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

/* 下拉选项样式 */
.select-box option {
    padding: 12px;
    font-size: 16px;
    background: var(--card);
    color: var(--text);
}

.select-box option[value="low"] {
    color: #3b82f6;
    background: linear-gradient(45deg, rgba(59, 130, 246, 0.1), transparent);
}

.select-box option[value="medium"] {
    color: #f59e0b;
    background: linear-gradient(45deg, rgba(245, 158, 11, 0.1), transparent);
}

.select-box option[value="high"] {
    color: #ef4444;
    background: linear-gradient(45deg, rgba(239, 68, 68, 0.1), transparent);
}

/* 文本框样式 */
.input-box-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--slider-bg);
    border-radius: 12px;
    font-size: 16px;
    min-height: 120px;
    margin-bottom: 20px;
    resize: none;
    background: var(--card);
    color: var(--text);
    transition: all 0.3s var(--animation-curve);
    -webkit-appearance: none;
    appearance: none;
}

.input-box-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

/* 按钮样式 */
.notify-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--animation-curve);
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
}

.notify-btn:active {
    transform: scale(0.98);
}

/* 滑块样式 */
.call-slider {
    width: 100%;
    height: 50px;
    background: var(--slider-bg);
    border-radius: 25px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--animation-curve);
    touch-action: none;
    margin-bottom: 15px;
}

.call-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slider-text);
    font-size: 16px;
    z-index: 1;
    transition: opacity 0.3s var(--animation-curve);
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.call-handle {
    position: absolute;
    left: 2px;
    top: 2px;
    width: 46px;
    height: 46px;
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    border-radius: 23px;
    z-index: 2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s var(--animation-curve);
    will-change: transform;
}

.call-handle::after {
    content: '📞';
    animation: handlePulse 1.5s infinite;
    will-change: transform;
}

.call-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.1),
        rgba(59, 130, 246, 0.2));
    transition: width 0.1s linear;
    will-change: width;
}

/* 主题切换按钮样式 */
.theme-toggles {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    z-index: 100;
}

.theme-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 16px;
    background: var(--card);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s var(--animation-curve);
    -webkit-tap-highlight-color: transparent;
}

.theme-btn:hover {
    transform: translateY(-2px);
}

.theme-btn.active {
    background: var(--primary);
    color: white;
}

/* 认证按钮样式 */
.auth-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
}

.auth-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--animation-curve);
    min-width: 80px;
}

.auth-btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-btn:disabled {
    background-color: var(--slider-bg);
    cursor: not-allowed;
    opacity: 0.6;
}

.admin-btn {
    background-color: var(--admin-color);
}

.admin-btn:hover {
    background-color: var(--admin-dark);
}

/* Toast提示样式 */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--animation-curve);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* 页脚样式 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: transparent; /* 设置背景色为透明 */
    border-top: none; /* 移除顶部边框 */
    padding: 8px 15px; /* 减少内边距，降低高度 */
    text-align: center;
    z-index: 999;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-text {
    font-size: 11px; /* 稍微减小字体大小 */
    color: #999; /* 设置为灰色 */
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-text a {
    color: #999; /* 设置为灰色 */
    text-decoration: none;
    transition: color 0.3s var(--animation-curve);
}

.footer-text a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.toast-container.show {
    opacity: 1;
    visibility: visible;
}

.toast-content {
    background: var(--toast-bg);
    border-radius: 20px;
    padding: clamp(20px, 5vw, 25px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-width: min(300px, 90vw);
    max-width: 90%;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.3s var(--animation-curve);
    box-shadow: var(--toast-shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-container.show .toast-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 成功状态的转圈圈动画 */
.toast-success {
    width: 32px;
    height: 32px;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top: 3px solid white;
    border-right: 3px solid rgba(255, 255, 255, 0.5);
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
    animation: spin 1s linear infinite;
}


/* 错误状态的转圈圈动画 */
.toast-error {
    width: 32px;
    height: 32px;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top: 3px solid white;
    border-right: 3px solid rgba(255, 255, 255, 0.5);
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
    animation: spin 1s linear infinite;
}

/* 加载状态的动画 */
.toast-loading {
    width: 32px;
    height: 32px;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top: 3px solid white;
    border-right: 3px solid rgba(255, 255, 255, 0.5);
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
    animation: spin 1s linear infinite;
}

.toast-message {
    color: var(--text);
    font-size: 18px;
    text-align: center;
    font-weight: 500;
    margin-top: 10px;
    animation: messageSlide 0.3s var(--animation-curve);
}

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


.toast-container.show {
    opacity: 1;
    visibility: visible;
}

.toast-content {
    background: var(--toast-bg);
    border-radius: 20px;
    padding: clamp(20px, 5vw, 25px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-width: min(300px, 90vw);
    max-width: 90%;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.3s var(--animation-curve);
    box-shadow: var(--toast-shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-container.show .toast-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* 紧急程度选择器样式 */
.urgency-selector {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.urgency-selector label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.urgency-options {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.urgency-btn {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--slider-bg);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s var(--animation-curve);
    position: relative;
    overflow: hidden;
}

.urgency-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.urgency-btn.active {
    border-color: var(--primary);
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    color: white;
}

.urgency-btn[data-urgency="urgent"].active {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    border-color: #f59e0b;
}

.urgency-btn[data-urgency="very-urgent"].active {
    background: linear-gradient(45deg, #ef4444, #dc2626);
    border-color: #ef4444;
}

/* 历史记录中的紧急程度标签样式 */
.history-urgency {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

.history-urgency-normal {
    background: var(--primary);
}

.history-urgency-urgent {
    background: #f59e0b;
}

.history-urgency-very-urgent {
    background: #ef4444;
}

/* 历史记录样式 */
.history-toggle {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    background: var(--slider-bg);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.clear-history-btn {
    padding: 6px 8px;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s var(--animation-curve);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-history-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

/* 历史记录图标样式 */
.history-icon {
    margin-right: 8px;
    font-size: 16px;
    display: inline-block;
    vertical-align: middle;
}

/* 历史记录类型样式 - 统一视觉效果 */
.history-type-sms, .history-type-call {
    position: relative;
    transition: all 0.3s var(--animation-curve);
}

.history-type-sms {
    border-color: #3b82f6;
}

.history-type-call {
    border-color: #8b5cf6;
}

.history-type-sms::before,
.history-type-call::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 80%;
    border-radius: 2px;
}

.history-type-sms::before {
    background: #3b82f6;
}

.history-type-call::before {
    background: #8b5cf6;
}

.history-type-sms:hover,
.history-type-call:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.history-toggle:hover {
    border-color: var(--primary);
}

.history-list {
    margin-top: 15px;
    display: none;
}

.history-list.show {
    display: block;
    animation: slideDown 0.3s var(--animation-curve);
    margin-bottom: 80px; /* 添加底部边距，避免被页脚遮挡 */
}

.history-item {
    background: var(--card);
    border: 2px solid var(--slider-bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    color: var(--text);
}

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

.history-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: white;
}

.history-badge.low { background: #3b82f6; }
.history-badge.medium { background: #f59e0b; }
.history-badge.high { background: #ef4444; }

.history-time {
    font-size: 12px;
    color: var(--slider-text);
    margin-top: 8px;
}

/* 动画 */
@keyframes titlePulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

@keyframes titleUnderline {
    0%, 100% { width: 50px; opacity: 0.5; }
    50% { width: 100px; opacity: 1; }
}

@keyframes handlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

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

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        border-radius: 12px;
    }

    .notify-btn {
        padding: 12px;
        font-size: 16px;
    }

    .call-slider {
        height: 46px;
    }

    .call-handle {
        width: 42px;
        height: 42px;
    }

    .toast-content {
        padding: 20px;
    }
    
    .theme-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .theme-toggles {
        top: 8px;
        right: 8px;
        gap: 4px;
    }
}