/**
 * 房屋租赁登记备案系统 - 样式文件
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #1e5799 0%, #2989d8 50%, #207cca 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    font-weight: normal;
}

.header .user-info {
    font-size: 14px;
}

.header .user-info a {
    color: white;
    text-decoration: none;
    margin-left: 15px;
}

.header .user-info a:hover {
    text-decoration: underline;
}

/* 导航菜单 */
.nav {
    background-color: #2c3e50;
    margin-bottom: 20px;
}

.nav ul {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    list-style: none;
    display: flex;
}

.nav li {
    margin: 0;
}

.nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 25px;
    transition: background-color 0.3s;
}

.nav a:hover, .nav a.active {
    background-color: #34495e;
}

/* 主内容区 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.card-body {
    padding: 20px;
}

/* 表单样式 */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.form-group {
    flex: 1;
    min-width: 250px;
    padding: 0 10px;
    margin-bottom: 20px;
}

.form-group.full-width {
    flex: 0 0 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.form-group label .required {
    color: #e74c3c;
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 25px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #219a52;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

.btn-warning:hover {
    background-color: #d68910;
}

.btn-sm {
    padding: 5px 15px;
    font-size: 12px;
}

/* 导出按钮样式 */
.search-bar .btn-success {
    background-color: #27ae60;
    margin-left: 5px;
}

.search-bar .btn-success:hover {
    background-color: #219a52;
}

/* 表单提示信息 */
.form-tip {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #e74c3c;
}

.form-tip.warning::before {
    content: "⚠️ ";
}

/* 验证错误提示 */
.validation-error {
    background: #fff5f5;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.validation-error .error-title {
    color: #c0392b;
    font-weight: bold;
    margin-bottom: 5px;
}

.validation-error .error-detail {
    color: #666;
    font-size: 14px;
}

/* 搜索栏 */
.search-bar {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.search-bar .form-group {
    margin-bottom: 0;
    flex: 0 0 auto;
}

/* 表格样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.data-table .actions {
    white-space: nowrap;
}

.data-table .actions .btn {
    margin-right: 5px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    list-style: none;
}

.pagination li {
    margin: 0 3px;
}

.pagination a {
    display: block;
    padding: 8px 15px;
    background: white;
    border: 1px solid #ddd;
    color: #3498db;
    text-decoration: none;
    border-radius: 4px;
}

.pagination a:hover,
.pagination a.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* 消息提示 */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* 登录页面 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

/* 打印预览 */
.print-preview {
    background: white;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    min-height: 600px;
    padding-bottom: 120px;
}

.print-preview h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: normal;
}

.print-preview .cert-no {
    text-align: right;
    margin-bottom: 30px;
    font-size: 14px;
}

.print-preview table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.print-preview table,
.print-preview th,
.print-preview td {
    border: 1px solid #333;
}

.print-preview th,
.print-preview td {
    padding: 12px 15px;
    text-align: center;
}

.print-preview th {
    background-color: #f5f5f5;
    width: 15%;
}

.print-preview .tips {
    font-size: 12px;
    line-height: 2;
    margin-top: 30px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .form-group {
        flex: 0 0 100%;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar .form-group {
        width: 100%;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 15px;
    margin-top: 30px;
    font-size: 12px;
    color: #999;
}

.footer p {
    margin: 3px 0;
}

.footer a {
    color: #999;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ==================== 列表页面优化样式 ==================== */

/* 搜索面板 */
.search-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
}

.search-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-icon {
    font-size: 20px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
}

.search-item label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.5;
}

.input-with-icon input {
    padding-left: 40px;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-inputs input {
    flex: 1;
}

.date-separator {
    color: #999;
    font-size: 14px;
}

.search-actions {
    display: flex;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.btn-search,
.btn-reset,
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-reset {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
}

.btn-reset:hover {
    background: #e9ecef;
}

.btn-export {
    background: #d4edda;
    color: #155724;
}

.btn-export:hover {
    background: #c3e6cb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(21, 87, 36, 0.15);
}

@media (max-width: 992px) {
    .search-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .search-actions {
        flex-wrap: wrap;
    }
    
    .btn-search,
    .btn-reset,
    .btn-export {
        flex: 1;
        justify-content: center;
    }
    
    .date-inputs {
        flex-direction: column;
    }
    
    .date-separator {
        display: none;
    }
}

/* 列表卡片 */
.list-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.list-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-icon {
    font-size: 22px;
}

.record-count {
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    padding: 6px 15px;
    border-radius: 20px;
}

.record-count strong {
    font-size: 18px;
    margin: 0 3px;
}

/* 现代表格样式 */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table thead th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    font-size: 14px;
    padding: 16px 15px;
    text-align: left;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.modern-table tbody tr {
    transition: all 0.2s ease;
}

.modern-table tbody tr:hover {
    background: #f8f9ff;
    transform: translateX(3px);
}

.modern-table tbody td {
    padding: 16px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    vertical-align: middle;
}

/* 备案编号徽章 */
.cert-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: monospace;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.3);
}

/* 日期徽章 */
.date-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 500;
}

/* 地址单元格 */
.address-cell {
    color: #555;
    line-height: 1.5;
}

/* 操作按钮组 */
.action-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 图标按钮 */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-icon span {
    font-size: 14px;
}

.btn-print {
    background: #d4edda;
    color: #155724;
}

.btn-print:hover {
    background: #c3e6cb;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-view {
    background: #cce5ff;
    color: #004085;
}

.btn-view:hover {
    background: #b3d7ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-edit {
    background: #fff3cd;
    color: #856404;
}

.btn-edit:hover {
    background: #ffeaa7;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-delete {
    background: #f8d7da;
    color: #721c24;
}

.btn-delete:hover {
    background: #f5c6cb;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 空状态优化 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fafafa;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

/* 分页样式优化 */
.pagination {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    list-style: none;
    gap: 5px;
}

.pagination li {
    margin: 0;
}

.pagination a {
    display: block;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 40px;
    text-align: center;
}

.pagination a:hover,
.pagination a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .action-btns {
        flex-direction: column;
        gap: 5px;
    }
    
    .btn-icon {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .modern-table thead th:nth-child(3),
    .modern-table tbody td:nth-child(3) {
        display: none;
    }
    
    .cert-badge {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* ==================== 分页控件样式 ==================== */

.pagination-container {
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-size-selector label {
    font-size: 14px;
    color: #666;
}

.page-size-select {
    padding: 8px 35px 8px 12px;
    font-size: 14px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s;
}

.page-size-select:hover {
    border-color: #667eea;
}

.page-size-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pagination-detail {
    font-size: 14px;
    color: #666;
}

.pagination-detail strong {
    color: #333;
    font-weight: 600;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .pagination-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pagination-detail {
        font-size: 13px;
    }
}

/* 打印样式 */
@media print {
    .header, .nav, .search-bar, .actions, .btn, .footer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: none;
    }
    
    body {
        background: white;
    }
}

/* ==================== 附件上传相关样式 ==================== */

/* 附件上传区域 */
.attachment-upload-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* 附件网格列表 - 编辑页面 */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.attachment-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.attachment-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.attachment-preview {
    width: 100%;
    height: 150px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.attachment-preview img:hover {
    transform: scale(1.05);
}

.attachment-info {
    padding: 12px;
}

.attachment-type {
    font-size: 12px;
    color: #3498db;
    font-weight: 500;
    margin-bottom: 5px;
}

.attachment-name {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.attachment-meta {
    font-size: 11px;
    color: #7f8c8d;
}

.attachment-actions {
    padding: 0 12px 12px;
    text-align: center;
}

.attachment-actions .btn {
    width: 100%;
}

/* 附件展示网格 - 查看页面 */
.attachment-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.attachment-view-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.attachment-view-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.attachment-view-preview {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.attachment-view-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.attachment-view-preview:hover img {
    transform: scale(1.05);
}

.attachment-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.attachment-view-preview:hover .attachment-view-overlay {
    opacity: 1;
}

.attachment-view-overlay span {
    color: white;
    font-size: 14px;
    padding: 8px 16px;
    border: 2px solid white;
    border-radius: 4px;
}

.attachment-view-info {
    padding: 15px;
}

.attachment-view-type {
    font-size: 13px;
    color: #3498db;
    font-weight: 600;
    margin-bottom: 6px;
}

.attachment-view-name {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.attachment-view-meta {
    font-size: 12px;
    color: #7f8c8d;
}

/* 进度条样式 */
#upload_progress {
    margin-top: 10px;
}

#upload_progress > div {
    background: #ecf0f1;
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

#progress_bar {
    background: linear-gradient(90deg, #3498db, #2980b9);
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

/* 按钮禁用状态 */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .attachment-grid,
    .attachment-view-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .attachment-preview,
    .attachment-view-preview {
        height: 120px;
    }

    .attachment-upload-section .form-row {
        flex-direction: column;
    }

    .attachment-upload-section .form-group {
        flex: 0 0 100%;
    }
}
