/* =======================================================
   统一的样式文件
   ======================================================= */

/* -------------------------------------------------------
   通用样式 (Global Styles)
   ------------------------------------------------------- */
body {
    font-family: 'Roboto', Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 3;
    padding: 0;
    box-sizing: border-box;
    color: #333;
    line-height: 1.4;
}

.app-container {
    padding: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

/* -------------------------------------------------------
   主容器和标题 (Main Container & Header)
   ------------------------------------------------------- */
.main-container {
    max-width: 900px;
    /* 调整为更小的顶部间距 */
    margin: 10px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* 调整标题的顶部间距 */
h1 {
    text-align: center;
    color: #343a40;
    font-size: 24px;
    margin-top: 0; /* 标题与顶部容器紧邻 */
    margin-bottom: 15px; 
    font-weight: 700;
}

.btn-back {
    display: inline-block; 
    text-decoration: none;
    color: #fff;
    background-color: #007bff;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

/* -------------------------------------------------------
   表单布局 (Form Layout) - 电脑端
   ------------------------------------------------------- */
.form-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.form-card {
    flex: 1;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1px;
    padding-bottom: 10px;
    border-bottom: none; /* 移除卡片头部的横线 */
}

.card-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.icon {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 1.2em;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    margin-right: 10px;
}

.icon.sender { background-color: #2ECC71; }
.icon.recipient { background-color: #3498DB; }
.icon.parcel { background-color: #f39c12; }

/* -------------------------------------------------------
   输入框和按钮 (Inputs & Buttons)
   ------------------------------------------------------- */
.input-group {
    margin-bottom: 15px;
}
.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 0.9em;
}

input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s;
}

input:focus, textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.checkbox-group {
    display: flex;
    align-items: center;
    background-color: transparent;
    border: none;
    padding: 0;
}

.insurance-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #28a745;
    border: 3px solid #d4edda;
    padding: 5px;
    border-radius: 8px;
    margin-bottom: 15px;
}
.checkbox-group input[type="checkbox"] {
    margin-right: 20px;
}
.checkbox-group label {
    margin-bottom: 0;
}

.insurance-terms-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: color 0.2s;
}
.insurance-terms-link:hover {
    color: #0056b3;
}


.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: none; /* 移除表单底部的横线 */
    margin-top: 20px;
}

.estimated-cost-display {
    flex-grow: 1;
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
}
/* 电脑端保险费样式 */
.estimated-cost-display #insurance-cost-display {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    font-weight: normal;
    color: #555;
}
.cost-value {
    display: block;
    font-size: 1.5em;
    color: #28a745;
    font-weight: 700;
}

.btn-primary {
    padding: 12px 25px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    box-shadow: 4px 4px 15px rgba(0, 123, 255, 0.3);
}
#success-message-container .btn-primary {
    padding: 10px 20px;
    font-size: 14px;
    display: inline-block;
    width: auto;
    max-width: 200px;
    margin: 15px auto 0;
}
.btn-primary:hover { background-color: #0056b3; }

.btn-camera, .btn-gallery {
    padding: 10px 15px;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.95em;
}
.btn-camera { background-color: #6c757d; }
.btn-gallery { background-color: #17a2b8; }

/* -------------------------------------------------------
   消息和图片 (Messages & Photos)
   ------------------------------------------------------- */
.message {
    padding: 12px;
    margin: 15px 0;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
}
.message.success { background-color: #d4edda; color: #155724; }
.message.error { background-color: #f8d7da; color: #721c24; }

.photo-preview-item {
    position: relative;
    display: inline-block;
    margin: 5px;
    width: 80px; 
    height: 80px;
    overflow: hidden;
}
.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 5px;
}
.remove-photo-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
}

/* 新增的模态框样式 - 通用 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
/* 模态框内容 - 通用 */
.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* 摄像头模态框特有样式 */
#camera-modal .modal-content {
    background-color: #000;
    max-width: 95%;
    max-height: 95%;
    padding: 0;
    box-shadow: none;
}
#camera-feed {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}
#camera-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    width: 100%;
}
.camera-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* 自定义提示弹窗样式 */
#custom-alert-modal .modal-content {
    max-width: 300px;
    min-width: 250px;
    padding: 20px;
}
#custom-alert-message {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #333;
}
#custom-alert-ok-btn {
    padding: 8px 20px;
    font-size: 1em;
}

/* 新增的现代风格弹窗样式 */
#collect-success-modal .modal-content {
    max-width: 350px; /* 增加最大宽度 */
    padding: 30px; /* 增加内边距 */
    border-radius: 12px; /* 增加圆角 */
}
#collect-success-modal .modal-header {
    border-bottom: none;
    margin-bottom: 15px;
}
#collect-success-modal .modal-title {
    font-size: 1.6em; /* 增大标题字体 */
    font-weight: bold;
    color: #333;
    margin: 0;
}
#collect-success-modal .modal-body p {
    font-size: 1em;
    color: #555;
    margin: 0;
}
#collect-success-modal .tracking-number-text {
    font-size: 1.2em;
    font-weight: bold;
    color: #007bff; /* 蓝色高亮 */
    word-break: break-all;
    display: block; /* 使运单号独立一行 */
    margin-top: 5px;
}
#collect-success-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 25px;
}
#collect-success-modal .modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
#collect-success-modal .close-btn {
    background-color: #e0e0e0;
    color: #555;
}
#collect-success-modal .close-btn:hover {
    background-color: #d5d5d5;
    transform: translateY(-2px);
}
#collect-success-modal .primary-btn {
    background-color: #007bff;
    color: white;
}
#collect-success-modal .primary-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}


/* -------------------------------------------------------
   响应式设计 (Responsive Design) - **手机端优化**
   ------------------------------------------------------- */
@media (max-width: 600px) {
    /* 缩小页面容器外边距，让内容更宽 */
    .app-container {
        /* 调整为更小的顶部内边距 */
        padding-top: 0px;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 0;
    }
    .main-container {
        margin: 0;
        padding: 0px;
        box-shadow: none;
    }
    
    /* 字体和间距调整，更紧凑 */
    h1 {
        font-size: 24px;
        margin-top: 15px;
        margin-bottom: 0px;
    }
    .btn-back {
        font-size: 14px;
        padding: 4px 8px;
        margin-bottom: 10px;
    }
    .form-card {
        padding: 10px;
        margin-bottom: 10px;
        box-shadow: none;
    }
    
    /* 隐藏输入框标签，但保留包裹照片的标签 */
    .input-group label {
        display: none;
    }
    .input-group label[data-lang="parcel_photos"] {
        display: block;
        font-size: 1em;
        margin-bottom: 5px;
    }
    
    /* 调整输入框的边框颜色和间距 */
    .input-group {
        margin-bottom: 10px;
    }
    .sender-card { border-left: 7px solid #2ECC71; }
    .recipient-card { border-left: 7px solid #3498DB; }
    .sender-card, .recipient-card {
        border-radius: 0;
        border-top: none;
        border-right: none;
        border-bottom: none;
    }
    /* 确保主要标题依然可见 */
    .card-header h3 {
        display: block;
        font-size: 1.1em;
    }
    /* 隐藏发件人/收件人卡片里的图标 */
    .sender-card .icon, .recipient-card .icon {
        display: none;
    }
    /* 修复手机端“购买保险”文本不可见的问题 */
    .insurance-options .checkbox-group label {
        display: block; 
        font-size: 14px;
        color: #333;
    }
    /* 手机端保险费字体调整 */
    .estimated-cost-display #insurance-cost-display {
        font-size: 0.9em;
        font-weight: normal;
        margin-top: 5px;
        text-align: center;
        color: #555;
    }

    input[type="text"], input[type="number"], textarea, select {
        padding: 8px;
        font-size: 14px;
    }
    
    /* 布局调整：垂直堆叠 */
    .form-grid {
        flex-direction: column;
        gap: 0;
    }
    
    /* 底部按钮布局调整 */
    .form-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .estimated-cost-display {
        margin-bottom: -10px;
        text-align: center;
    }
    .cost-value {
        font-size: 1.3em;
    }
    .btn-primary, .btn-camera, .btn-gallery {
        width: 100%;
        padding: 10px 15px;
        font-size: 1em;
    }
    .camera-buttons {
        flex-direction: column;
        gap: 10px;
    }

    /* 手机端自定义弹窗样式调整 */
    #custom-alert-modal .modal-content {
        max-width: 80%;
        padding: 15px;
    }
    #custom-alert-message {
        font-size: 1em;
        margin-bottom: 15px;
    }
    #custom-alert-ok-btn {
        padding: 6px 15px;
        font-size: 0.9em;
    }

    /* 移动端弹窗按钮布局 */
    #collect-success-modal .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
}

/* 移动端底部导航在键盘弹出时的处理 */
.mobile-nav {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-nav.mobile-nav--hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}