/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* 登录页面样式 */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-form {
    width: 100%;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

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

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.login-footer {
    color: #888;
    font-size: 0.85rem;
}

/* 仪表板页面样式 */
.dashboard-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 顶部导航栏样式 */
.top-navbar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 0;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

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

.navbar-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(238, 90, 36, 0.4);
}

/* 产品统计导航 */
.navbar-stats {
    padding: 20px 30px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

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

.stats-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.total-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.total-label {
    opacity: 0.9;
}

.total-number {
    font-size: 1.4rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.total-unit {
    opacity: 0.9;
    font-size: 0.85rem;
}

.status-indicator {
    font-size: 0.9rem;
    margin-left: 5px;
}

.status-indicator.good {
    color: #4ade80;
}

.status-indicator.warning {
    color: #fbbf24;
}

.status-indicator.low {
    color: #f87171;
}

.status-text {
    font-size: 0.85rem;
    opacity: 0.95;
}

/* 产品统计列表 */
.stats-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.stat-badge {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: default;
}

.stat-badge:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.stat-badge.empty {
    color: #999;
    border-style: dashed;
}

.badge-name {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.badge-count {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 30px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 数量更新动画 */
.total-number.count-update,
.badge-count.count-update {
    animation: countPulse 0.5s ease-in-out;
}

@keyframes countPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.dashboard-main {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.function-buttons {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
    max-width: 500px;
}

.function-btn {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    text-align: left;
    width: 100%;
    border: 2px solid transparent;
}

.function-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.import-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(102, 126, 234, 0.05));
}

.export-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.05));
}

.btn-icon {
    font-size: 3rem;
    opacity: 0.8;
    min-width: 80px;
    text-align: center;
}

.btn-text h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.btn-text p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    padding: 20px;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 25px 30px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f5f5f5;
    color: #666;
}

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

.modal-desc {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group input[type="number"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.import-actions,
.export-actions,
.result-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary:hover {
    background: #e9ecef;
    color: #495057;
}

/* 结果显示样式 */
#resultContent {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.result-text {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 15px;
}

.result-summary {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 15px;
}

.result-summary strong {
    color: #007bff;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 2000;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #212529;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .top-navbar {
        border-radius: 15px;
    }
    
    .navbar-header {
        flex-direction: column;
        text-align: center;
        padding: 15px 20px;
        gap: 15px;
    }
    
    .navbar-header h1 {
        font-size: 1.4rem;
    }
    
    .navbar-actions {
        width: 100%;
        justify-content: center;
    }
    
    .navbar-stats {
        padding: 15px 20px;
    }
    
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .total-badge {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-list {
        gap: 8px;
    }
    
    .stat-badge {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .function-btn {
        padding: 25px 20px;
    }
    
    .btn-icon {
        font-size: 2.5rem;
        min-width: 60px;
    }
    
    .btn-text h3 {
        font-size: 1.2rem;
    }
    
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 40px);
    }
    
    .modal-header,
    .modal-body {
        padding: 20px;
    }
    
    .import-actions,
    .export-actions,
    .result-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .login-title {
        font-size: 1.6rem;
    }
    
    .function-buttons {
        gap: 20px;
    }
    
    .function-btn {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .btn-text {
        text-align: center;
    }
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* 产品管理模态框样式 */
.modal-large {
    max-width: 900px;
}

.product-manage-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

.product-form {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px solid #e1e5e9;
}

.product-form h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.product-form .input-group {
    margin-bottom: 15px;
}

.product-form input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

.product-form input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.product-list {
    overflow-x: auto;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.product-table thead {
    background: #f8f9fa;
}

.product-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.product-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
}

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

.product-table .badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.text-center {
    text-align: center;
}

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

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

.product-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.help-text {
    display: block;
    margin-top: 8px;
    color: #6c757d;
    font-size: 0.85rem;
}

.help-text span {
    font-weight: 600;
    color: #667eea;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 响应式设计补充 */
@media (max-width: 768px) {
    .product-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-large {
        max-width: 100%;
    }
    
    .product-table {
        font-size: 0.8rem;
    }
    
    .product-table th,
    .product-table td {
        padding: 8px 10px;
    }
}
