/*
 * 文件名: admin.css
 * 描述: 后台管理页面样式 (登录, 列表, 房间管理)
 */

/* --- 通用样式 --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

.panel {
    background-color: #252525;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn {
    padding: 10px 15px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: #4dabf7;
    color: white;
}

.btn-primary:hover {
    background-color: #339af0;
}

.btn-danger {
    background-color: #fa5252;
    color: white;
}

.btn-danger:hover {
    background-color: #e03131;
}

.btn-save {
    background-color: #2f9e44;
    color: white;
}

.btn-save:hover {
    background-color: #2b8a3e;
}

.btn-secondary {
    background-color: #868e96;
    color: white;
}

.btn-secondary:hover {
    background-color: #495057;
}

.btn-toggle-run.run {
    background-color: #fa5252;
    color: white;
}

.btn-toggle-run.stop {
    background-color: #2f9e44;
    color: white;
}

.btn-reset {
    background-color: #fab005;
    color: #111;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 5px;
    font-size: 14px;
    color: #aaa;
}

input,
select {
    background: #333;
    border: 1px solid #555;
    color: #eee;
    padding: 8px;
    border-radius: 4px;
    font-size: 1em;
}

/* --- 登录页面 (Login Page) --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f2f5;
}

.login-container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 400px;
    max-width: 90%;
    min-width: 320px;
    box-sizing: border-box;
}

.login-container h1 {
    color: #333;
    margin-bottom: 20px;
}

.login-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #f5f5f5;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

.login-container input:focus {
    border-color: #007bff;
    background-color: #fff;
}

.login-container button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

/* Master Dashboard Generator List Table */
.gen-list {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.gen-list th,
.gen-list td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #444;
    vertical-align: middle;
    word-break: break-word;
}

.gen-list th {
    background-color: #333;
    color: #4dabf7;
    font-weight: bold;
    white-space: nowrap;
}

.gen-list tr:hover {
    background-color: #2c2c2c;
}

/* Column specific widths */
.gen-list th:nth-child(1),
.gen-list td:nth-child(1) {
    width: 50px;
    text-align: center;
}

/* ID */
.gen-list th:nth-child(2),
.gen-list td:nth-child(2) {
    width: 15%;
}

/* Name */
.gen-list th:nth-child(3),
.gen-list td:nth-child(3) {
    width: 25%;
}

/* Remark */
.gen-list th:nth-child(4),
.gen-list td:nth-child(4) {
    width: 80px;
    text-align: center;
}

/* URL */
.gen-list th:nth-child(5),
.gen-list td:nth-child(5) {
    width: 110px;
    text-align: center;
}

/* Date */
.gen-list th:nth-child(6),
.gen-list td:nth-child(6) {
    width: 200px;
    text-align: center;
}

/* Actions */

.smtp-list {
    table-layout: auto;
    white-space: nowrap;
}

.smtp-list th:nth-child(n),
.smtp-list td:nth-child(n) {
    width: auto;
}

.gen-list .actions {
    white-space: nowrap;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.gen-list .actions form {
    margin: 0;
}

.gen-list .btn {
    padding: 5px 8px;
    font-size: 12px;
}

.dark-theme-body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    padding: 20px;
}

.dark-theme-body a {
    color: #4dabf7;
    text-decoration: none;
}

.dark-theme-body a:hover {
    color: #74c0fc;
    text-decoration: underline;
}

/* Fix for buttons that are <a> tags */
.dark-theme-body a.btn-primary,
.dark-theme-body a.btn-save,
.dark-theme-body a.btn-danger,
.dark-theme-body a.btn-secondary {
    color: white;
    text-decoration: none;
}

.dark-theme-body a.btn-reset {
    color: #111;
    text-decoration: none;
}

.dark-theme-body .container {
    max-width: 900px;
}

.dark-theme-body h1,
.dark-theme-body h2 {
    color: #e9ecef;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.dark-theme-body .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.dark-theme-body h1 {
    margin: 0;
    border-bottom: none;
}

.dark-theme-body .logout {
    background: #c92a2a;
    color: white;
    padding: 8px 12px;
    font-size: 14px;
}

.dark-theme-body .room-list {
    list-style: none;
    padding: 0;
}

.dark-theme-body .room-item {
    background-color: #333;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.dark-theme-body .room-item h3 {
    margin: 0;
    font-size: 1.2em;
}

.dark-theme-body .room-actions {
    display: flex;
    gap: 10px;
}

.dark-theme-body .form-inline {
    display: flex;
    gap: 10px;
}

.dark-theme-body .form-inline input {
    flex-grow: 1;
}

.dark-theme-body .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: flex-end;
}

.dark-theme-body table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background-color: #252525;
    border-radius: 6px;
    overflow: hidden;
}

.dark-theme-body th {
    background-color: #1a1a1a;
    font-weight: bold;
    color: #fff;
}

.dark-theme-body th,
.dark-theme-body td {
    padding: 12px;
    border-bottom: 1px solid #444;
    text-align: left;
}

.dark-theme-body tr:hover {
    background-color: #333;
}

.dark-theme-body .actions {
    display: flex;
    gap: 10px;
}

/* --- 房间管理页面 (Room Page) --- */
.room-page-body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    padding: 20px;
    font-size: 16px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.main-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.task-item {
    border: 2px solid #444;
    border-radius: 6px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.task-item.active {
    border-color: #4dabf7;
    box-shadow: 0 0 12px rgba(77, 171, 247, 0.7);
}

.task-header {
    background-color: #333;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.task-header h3 {
    margin: 0;
    flex-grow: 1;
    min-width: 150px;
}

.task-header h3 input {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #4dabf7;
    font-size: 1.4rem;
    font-weight: bold;
    padding: 5px 0;
    width: 100%;
    transition: all 0.2s;
}

.task-header h3 input:hover {
    border-bottom-color: #555;
}

.task-header h3 input:focus {
    background: #444;
    border-bottom-color: #4dabf7;
    outline: none;
    padding-left: 8px;
    border-radius: 4px;
}

.task-body {
    padding: 15px;
    background-color: #2c2c2c;
}

.task-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.preview-panel {
    background-color: #111;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.preview-time {
    font-size: 5em;
    font-weight: bold;
}

.preview-title {
    font-size: 1.5em;
    margin-bottom: 15px;
}

.progress-bar-container {
    width: 80%;
    background-color: #444;
    border-radius: 5px;
    padding: 3px;
    cursor: pointer;
    margin-top: 20px;
}

.progress-bar {
    height: 20px;
    border-radius: 3px;
    background-color: #ffffff;
    width: 0%;
}

.preview-ruler {
    width: 80%;
    height: 6px;
    margin-top: 4px;
    border-radius: 3px;
    background: #333;
    overflow: hidden;
    position: relative;
    display: none;
    /* Hidden by default */
}

.progress-bar.yellow {
    background-color: #e5a00d;
}

.progress-bar.red {
    background-color: #d82b3a;
}

.progress-bar.overtime {
    background: repeating-linear-gradient(45deg, #d82b3a, #d82b3a 10px, #000 10px, #000 20px);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #333;
    color: white;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 300px;
    text-align: center;
}

.close-button {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-button:hover {
    color: white;
}