@import url('../styles.css');

.dashboard {
    min-height: 100vh;
    padding: 20px;
    background-color: white;
    position: relative;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;  /* Updated from 60px */
}

.back-button,
.user-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.back-button svg,
.user-button svg {
    width: 24px;
    height: 24px;
    stroke: #27115F;
    transition: stroke 0.3s ease;
}

.back-button:hover svg,
.user-button:hover svg {
    stroke: #22D3C5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;  /* Updated to remove top/bottom padding, keep left/right */
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.search-container {
    position: relative;
    width: 300px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

#searchInput {
    width: 100%;
    padding: 0.5rem 0.5rem 0.5rem 2rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#itemsPerPage {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f8f8;
    font-weight: bold;
}

tr:hover {
    background-color: #f5f5f5;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin: 0 5px;
}

.view-btn {
    color: #4CAF50;
}

.delete-btn {
    color: #f44336;
}

.btn-icon:hover {
    opacity: 0.7;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-number {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.page-number.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.jump-input {
    width: 50px;
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Modal styles are already included in the imported styles.css */

/* ==================== 移动端适配 ==================== */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: 0 1.5rem;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .dashboard {
        padding: 15px;
    }

    .top-nav {
        margin-bottom: 8px;
    }

    .container {
        padding: 0 1rem;
    }

    .controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        margin-bottom: 1.5rem;
    }

    .search-container {
        width: 100%;
    }

    #searchInput {
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    #itemsPerPage {
        width: 100%;
        font-size: 16px;
    }

    /* 表格移动端滚动 */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: 700px;
        font-size: 13px;
    }

    thead, tbody, tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    th, td {
        padding: 0.6rem 0.4rem;
        font-size: 13px;
    }

    .btn-icon {
        padding: 4px;
        margin: 0 3px;
    }

    /* 分页移动端适配 */
    .pagination {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-number {
        padding: 0.4rem 0.6rem;
        font-size: 13px;
    }

    .jump-input {
        width: 45px;
        font-size: 13px;
    }

    /* 用户下拉菜单移动端优化 */
    .user-dropdown {
        position: absolute;
        top: 100%;
        right: 0;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        min-width: 110px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }

    .user-button:hover .user-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .dropdown-item {
        display: flex;
        align-items: center;
        padding: 10px 14px;
        color: #27115F;
        text-decoration: none;
        transition: all 0.3s ease;
        font-size: 13px;
    }

    .dropdown-item:first-child {
        border-radius: 8px 8px 0 0;
    }

    .dropdown-item:last-child {
        border-radius: 0 0 8px 8px;
    }

    .dropdown-item:hover {
        background: rgba(34, 211, 197, 0.1);
        color: #22D3C5;
    }

    .dropdown-item svg {
        width: 16px;
        height: 16px;
        margin-right: 8px;
        stroke: currentColor;
    }
}

@media (max-width: 480px) {
    .dashboard {
        padding: 10px;
    }

    .container {
        padding: 0 0.75rem;
    }

    .controls {
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    table {
        min-width: 600px;
        font-size: 12px;
    }

    th, td {
        padding: 0.5rem 0.3rem;
        font-size: 12px;
    }

    .btn-icon {
        padding: 3px;
        margin: 0 2px;
    }

    .view-btn svg,
    .delete-btn svg {
        width: 16px;
        height: 16px;
    }

    .pagination {
        gap: 0.75rem;
    }

    .page-number {
        padding: 0.3rem 0.5rem;
        font-size: 12px;
    }

    .jump-input {
        width: 40px;
        font-size: 12px;
    }
}
