/* dorm_system/style.css */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #eef2f7; /* 浅蓝色背景 */
    color: #333;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}
.container {
    max-width: 900px;
    width: 100%;
    margin: 20px auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px; /* 更圆润的边角 */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); /* 更明显的阴影 */
}
h1, h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
    font-weight: 600;
}
h3 {
    color: #34495e;
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: 600;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: calc(100% - 24px); /* 调整宽度 */
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px; /* 更圆润的输入框 */
    box-sizing: border-box;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="date"]:focus,
.form-group input[type="time"]:focus,
.form-group input[type="file"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}
.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group input[type="submit"], .button {
    background-color: #007bff;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-right: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.form-group input[type="submit"]:hover, .button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.button.logout {
    background-color: #dc3545;
}
.button.logout:hover {
    background-color: #c82333;
}
.button.secondary {
    background-color: #6c757d;
}
.button.secondary:hover {
    background-color: #5a6268;
}
.button.warning {
    background-color: #ffc107;
    color: #333;
}
.button.warning:hover {
    background-color: #e0a800;
}
.button.danger {
    background-color: #dc3545;
}
.button.danger:hover {
    background-color: #c82333;
}
.button.success {
    background-color: #28a745;
}
.button.success:hover {
    background-color: #218838;
}

.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-weight: bold;
    animation: fadeIn 0.5s ease-out;
}
.alert.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.alert.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
.text-center {
    text-align: center;
}
.section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fdfdfd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    border: 1px solid #eee;
    padding: 10px;
    text-align: left;
    vertical-align: middle;
}
th {
    background-color: #f8f8f8;
    font-weight: bold;
    color: #555;
}
td button, td .button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-size: 0.9em;
}
td button:hover, td .button:hover {
    transform: translateY(-1px);
}
/* 状态颜色 */
.status-on, .status-active, .status-completed, .status-not-banned { color: #28a745; font-weight: bold; } /* 绿色 */
.status-off, .status-inactive, .status-cancelled, .status-banned, .status-failed { color: #dc3545; font-weight: bold; } /* 红色 */
.status-pending, .status-processing, .status-medium { color: #ffc107; font-weight: bold; } /* 黄色 */
.status-simple { color: #17a2b8; font-weight: bold; } /* 青色 */
.status-complex { color: #6f42c1; font-weight: bold; } /* 紫色 */


/* Admin Navigation */
.admin-nav {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}
.admin-nav a {
    display: inline-block;
    padding: 10px 15px;
    margin: 0 5px;
    background-color: #343a40; /* 深色背景 */
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
.admin-nav a:hover {
    background-color: #495057;
}
.admin-nav a.active {
    background-color: #007bff;
}

/* Shop Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    text-align: center;
    padding-bottom: 15px;
}
.product-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}
.product-card h4 {
    margin: 15px 0 5px;
    color: #2c3e50;
    font-size: 1.2em;
}
.product-card p {
    color: #555;
    font-size: 0.9em;
    margin-bottom: 10px;
    padding: 0 15px;
}
.product-card .price {
    font-size: 1.3em;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 15px;
}
.product-card .quantity-control {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}
.product-card .quantity-control button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    margin: 0 5px;
}
.product-card .quantity-control input {
    width: 50px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px;
}

/* Modal (弹窗) 样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed; /* 固定定位 */
    z-index: 1000; /* 放置在最上层 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* 如果内容过多可滚动 */
    background-color: rgba(0,0,0,0.6); /* 半透明黑色背景 */
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}
.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    position: relative;
    animation: slideIn 0.3s ease-out;
}
.close-button {
    color: #aaa;
    float: right;
    font-size: 32px; /* 增大关闭按钮 */
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    line-height: 1; /* 调整行高 */
}
.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}
.modal-footer {
    text-align: right;
    margin-top: 25px;
}
.modal-footer button {
    margin-left: 10px;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 值日提醒样式 */
.duty-reminder {
    background-color: #fff3cd; /* 浅黄色背景，用于警告 */
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}
.duty-info {
    background-color: #e2f0cb; /* 浅绿色背景，用于信息 */
    color: #386641;
    border: 1px solid #c8e6c9;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    text-align: center;
}

/* 值日表样式 */
.duty-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.duty-table th, .duty-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}
.duty-table th {
    background-color: #f2f2f2;
}
.duty-table .morning { background-color: #e6f7ff; } /* 浅蓝色 */
.duty-table .afternoon { background-color: #f0f8ff; } /* 更浅的蓝色 */
.duty-table .unassigned { color: #888; font-style: italic; }


/* 聊天室容器 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px; /* 固定高度，内部滚动 */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fdfdfd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: relative; /* 用于禁言overlay */
}

/* 消息显示区域 */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto; /* 消息过多时滚动 */
    padding: 15px;
    background-color: #f8f8f8;
    display: flex; /* 使用flexbox让消息自动换行 */
    flex-direction: column;
}

/* 单条消息样式 */
.chat-message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 18px; /* 更圆润的消息气泡 */
    max-width: 80%;
    word-wrap: break-word; /* 自动换行 */
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.chat-message.self {
    background-color: #007bff;
    color: white;
    align-self: flex-end; /* 自己的消息靠右 */
    margin-left: auto;
    border-bottom-right-radius: 4px; /* 尖角效果 */
}

.chat-message.other {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start; /* 其他人的消息靠左 */
    margin-right: auto;
    border-bottom-left-radius: 4px; /* 尖角效果 */
}

.chat-message .username {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 3px;
    opacity: 0.8;
}
.chat-message.self .username {
    color: rgba(255, 255, 255, 0.9);
}

.chat-message .timestamp {
    font-size: 0.75em;
    color: #888;
    margin-top: 5px;
    display: block;
    text-align: right;
}
.chat-message.self .timestamp {
    color: rgba(255, 255, 255, 0.7);
}

.chat-message.deleted {
    font-style: italic;
    color: #888;
    background-color: #f0f0f0;
    text-align: center;
}
.chat-message.deleted .message-content {
    text-decoration: line-through;
}

/* 消息输入区域 */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    background-color: #fdfdfd;
}

.chat-input-area textarea {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: none; /* 禁止手动调整大小 */
    height: 40px; /* 固定高度 */
    font-size: 1em;
    box-sizing: border-box;
}

.chat-input-area button {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}
.chat-input-area button:hover {
    background-color: #0056b3;
}
.chat-input-area button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 禁言提醒 */
.chat-banned-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    color: #dc3545;
    font-weight: bold;
    z-index: 100;
    border-radius: 8px;
}


/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 15px;
        margin: 10px auto;
    }
    h1, h2 {
        font-size: 1.8em;
    }
    .form-group input[type="text"],
    .form-group input[type="password"],
    .form-group input[type="email"],
    .form-group input[type="number"],
    .form-group input[type="tel"],
    .form-group input[type="date"],
    .form-group input[type="time"],
    .form-group input[type="file"],
    .form-group textarea,
    .form-group select {
        width: 100%;
        padding: 10px;
        font-size: 15px;
    }
    .form-group input[type="submit"], .button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        font-size: 16px;
        padding: 10px 15px;
    }
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    th, td {
        min-width: 100px; /* 确保小屏幕下可滚动 */
        font-size: 0.9em;
        padding: 8px;
    }
    td button, td .button {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    .admin-nav {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-nav a {
        margin: 5px 0;
    }
    .product-grid {
        grid-template-columns: 1fr; /* 手机端单列显示 */
    }
    .chat-container {
        height: 400px; /* 手机端聊天室高度 */
    }
    .chat-message {
        max-width: 95%; /* 手机端消息宽度 */
    }
}