/* style.css - 药品管理APP的自定义样式 */

/* 确保样式优先级高于Tailwind */
html {
    font-size: 16px;
}

body {
    /* 强制设置背景和文字颜色 */
    background-color: #000000 !important;
    color: #ffffff !important;
    /* 平滑滚动效果，配合JS的scrollIntoView */
    scroll-behavior: smooth;
    /* 底部间距，防止内容被底部导航栏遮挡 */
    padding-bottom: 80px !important;
}

/* 全局字体和背景已在HTML中通过Tailwind设置，这里可以添加更精细的控制或覆盖 */

:root {
    --brand-blue: #007AFF; /* 定义品牌蓝色变量 */
}

/* 添加品牌蓝色类 */
.text-brand-blue {
    color: var(--brand-blue) !important;
}

.bg-brand-blue {
    background-color: var(--brand-blue) !important;
}

.hover\:bg-brand-blue:hover {
    background-color: var(--brand-blue) !important;
}

.focus\:ring-brand-blue:focus {
    --tw-ring-color: var(--brand-blue) !important;
}

/* 导航按钮样式 */
.nav-btn {
    position: relative;
    transition: all 0.3s ease;
}

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

/* 底部导航栏样式 */
footer .nav-btn {
    padding: 8px 12px;
    transition: all 0.2s ease;
}

footer .nav-btn:active {
    transform: scale(0.95);
}

/* 批次警告指示器 */
.batch-warning {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 10;
}

/* 头部导航栏样式 */
header h1 {
    /* 可以考虑使用更具设计感的字体或效果 */
    color: var(--brand-blue);
}

/* 主要内容区域的Section标题 */
section h2 {
    /* 强调核心要点的大字体 */
    font-size: clamp(2rem, 5vw, 3rem); /* 响应式字体大小 */
    color: var(--brand-blue);
}

/* 动画效果：进入视口时淡入 */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 亮蓝色高亮元素的透明度渐变 */
.highlight-gradient {
    background: linear-gradient(to bottom, rgba(0, 122, 255, 0.8), rgba(0, 122, 255, 0.3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* 同步通知样式 */
#sync-notification {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 针对Tailwind CSS的自定义 */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* 移动端优化样式 */
@media screen and (max-width: 768px) {
    /* 通用调整 */
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0.75rem;
    }
    
    /* 导航栏优化 */
    nav .container {
        padding: 0.25rem;
    }
    
    .nav-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        margin: 0.25rem 0.1rem;
        white-space: nowrap;
    }
    
    .nav-btn i {
        margin-right: 0.25rem;
    }
    
    /* 表单元素适配 */
    input, select, textarea, button {
        font-size: 16px; /* 防止iOS自动放大 */
    }
    
    /* 模态框调整 */
    #edit-drug-modal .bg-gray-800, 
    #edit-batch-modal .bg-gray-800 {
        width: 90%;
        max-width: 100%;
        max-height: 80vh;
        margin: 0 auto;
    }
    
    /* 药品卡片调整 */
    .bg-gray-800.p-4.rounded-lg.shadow-md {
        padding: 0.75rem;
    }
    
    /* 调整药品卡片中按钮的排列 */
    .flex.justify-between.items-start {
        flex-direction: column;
    }
    
    .flex.justify-between.items-start button.edit-drug-btn {
        margin-top: 0.5rem;
        align-self: flex-start;
    }
    
    /* 批次信息调整 */
    .batches-container .bg-gray-700.p-3.rounded {
        padding: 0.5rem;
    }
    
    .batches-container .flex.justify-between.items-start {
        flex-direction: column;
    }
    
    .batches-container .edit-batch-btn {
        margin-top: 0.5rem;
        align-self: flex-start;
    }
    
    /* 搜索结果容器 */
    #query-results {
        margin-top: 1rem;
    }
    
    /* 表单按钮调整 */
    .form-container .bg-brand-blue {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* 通知消息调整 */
    #operation-notification {
        width: 90%;
        max-width: 100%;
        left: 5%;
        right: 5%;
        text-align: center;
    }
    
    /* 图表容器高度调整 */
    #drug-consumption-chart-container,
    #other-stats-chart-container {
        height: 200px;
    }
    
    /* 批次管理页面的统计卡片 */
    #batch-management-section .grid {
        grid-template-columns: 1fr;
    }
    
    /* 批次筛选按钮 */
    #batch-management-section .flex.flex-wrap.items-center.space-x-2 {
        margin-bottom: 0.5rem;
    }
    
    #batch-management-section .flex.flex-wrap.items-center.space-x-2 button {
        margin: 0.25rem;
        font-size: 0.75rem;
    }
}

/* 平板设备适配 */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 90%;
    }
    
    /* 适当调整内边距 */
    .bg-gray-800.p-4.rounded-lg.shadow-md {
        padding: 1rem;
    }
    
    /* 导航栏按钮间距 */
    .nav-btn {
        margin: 0 0.25rem;
    }
}