/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base styles */
html, body {
    height: 100%;
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
}

/* Layout */
.page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

main {
    flex-grow: 1;
    overflow: hidden;
    background-color: white;
    border-radius: 8px;
    /*padding: 20px;*/
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 数据容器的动画样式 */
#data-container {
    position: relative;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
    min-height: 100%;
}

/* 数据卡片的基础样式和动画 */
.data-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.25s forwards;
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 页面切换动画 */
.slide-out {
    animation: slideOut 0.15s forwards;
}

.slide-in {
    animation: slideIn 0.15s forwards;
}

.slide-out-reverse {
    animation: slideOutReverse 0.15s forwards;
}

.slide-in-reverse {
    animation: slideInReverse 0.15s forwards;
}

/* 动画关键帧 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutReverse {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInReverse {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

footer {
    flex-shrink: 0;
    padding: 15px 0;
    text-align: center;
}
/* Typography */
h1 {
    color: #333;
    font-size: 24px;
}

/* Buttons */
button {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #45a049;
}

/* Pagination controls */
#pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#pagination-controls button {
    width: 80px;
    padding: 8px 0;
    border: 1px solid #ddd;
    background-color: #8ac156;
    text-align: center;
}

#pagination-controls button:hover {
    background-color: #618341;
}

#pagination-controls button.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

#pagination-controls span {
    margin: 0 10px;
    vertical-align: middle;
}


/* Grid Layout */
.data-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    height: 100%;
}

/* Card Component */
.data-card {
    height: 100%;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 120px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.35s ease;
}

.data-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-color: #8ac156;
}

/* Card Content */
.data-card .medicine-name {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    font-weight: normal;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    transition: color 0.5s ease;
}

.data-card .name {
    font-size: 18px;
    color: #333;
    margin: 5px 0;
    font-weight: bold;
    transition: color 0.5s ease;
}

.data-card .alias {
    color: #666;
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.4;
    padding: 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.5s ease;
}

/* Card Hover Effects */
.data-card:hover .medicine-name {
    color: rgba(255, 255, 255, 0.8);
}

.data-card:hover .name {
    color: white;
}

.data-card:hover .alias {
    color: rgba(255, 255, 255, 0.9);
}

/* Error Message */
.error-message {
    position: absolute;
    width: 300px;
    padding: 15px;
    background-color: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    color: #d32f2f;
    margin: 10px 0;
    text-align: center;
    left: 50%;
    transform: translateX(-50%);
}
