/* ===========================
   响应式设计
   =========================== */

/* 手机优先 (< 640px) */

.container {
    width: 100%;
    padding: 0 1rem;
    margin: 0 auto;
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid-1 {
    grid-template-columns: 1fr;
}

.grid-2 {
    grid-template-columns: 1fr;
}

.grid-3 {
    grid-template-columns: 1fr;
}

.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.open {
    display: block;
}

.hamburger-btn {
    display: flex;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle {
    display: none;
}

.navbar {
    padding: 1rem;
}

.navbar-brand {
    font-size: 1.25rem;
}

.navbar-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    flex-direction: column;
}

.navbar-menu.active {
    display: flex;
}

.navbar-menu a {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.navbar-menu a:last-child {
    border-bottom: none;
}

.page-content {
    padding: 1rem;
}

.card {
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

/* 平板 (640px - 1024px) */

@media (min-width: 640px) {
    .container {
        max-width: 640px;
        padding: 0 1.5rem;
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .navbar {
        padding: 1.5rem;
    }

    .navbar-brand {
        font-size: 1.5rem;
    }

    .page-content {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }
}

/* 平板横屏 (768px - 1024px) */

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }

    .sidebar {
        display: block;
        width: 250px;
        left: 0;
        position: fixed;
        top: 0;
        height: 100vh;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .hamburger-btn {
        display: none !important;
    }

    .sidebar-toggle {
        display: none;
    }

    .main-layout {
        display: flex;
        min-height: 100vh;
    }

    .main-content {
        flex: 1;
        margin-left: 250px;
    }

    .navbar {
        padding: 1.5rem 2rem;
    }

    .page-content {
        padding: 2rem;
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar-menu {
        list-style: none;
    }

    .sidebar-menu li {
        margin-bottom: 0.5rem;
    }

    .sidebar-menu a {
        display: block;
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        transition: all 0.3s ease;
    }

    .sidebar-menu a:hover {
        background-color: #e0e0e0;
    }

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

/* 桌面 (1024px+) */

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }

    .sidebar {
        width: 280px;
        left: 0;
    }

    .main-content {
        margin-left: 280px;
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .navbar {
        padding: 1.5rem 2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .navbar-menu {
        display: flex !important;
        position: static;
        flex-direction: row;
        background: transparent;
        border: none;
    }

    .navbar-menu a {
        padding: 0.5rem 1rem;
        border: none;
        border-radius: 0.5rem;
        transition: all 0.3s ease;
    }

    .navbar-menu a:hover {
        background-color: #f0f0f0;
    }

    .page-content {
        padding: 2rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }
}

/* 大桌面 (1280px+) */

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }

    .sidebar {
        width: 300px;
        left: 0;
    }

    .main-content {
        margin-left: 300px;
    }

    .page-content {
        padding: 2.5rem;
    }
}

/* 超大桌面 (1920px+) */

@media (min-width: 1920px) {
    .container {
        max-width: 1400px;
    }

    .page-content {
        padding: 3rem;
    }
}

/* ===========================
   触摸设备优化
   =========================== */

@media (hover: none) and (pointer: coarse) {
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1.125rem;
    }

    .form-control {
        padding: 1rem;
        font-size: 16px;
    }

    .card {
        margin-bottom: 1.5rem;
    }
}

/* ===========================
   打印样式
   =========================== */

@media print {
    .navbar,
    .sidebar,
    .btn-primary,
    .btn-secondary {
        display: none;
    }

    body {
        background: white;
    }

    .card {
        page-break-inside: avoid;
    }
}
