/* ============================================================
   Countdown Timer - ToolNova 风格
   ============================================================ */

body {
    margin: 0;
    min-height: 100vh;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    color: #1e293b;
    background:
        radial-gradient(circle at 15% 20%, rgba(99,102,241,.10) 0%, transparent 45%),
        radial-gradient(circle at 85% 10%, rgba(139,92,246,.08) 0%, transparent 40%),
        linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #f5f3ff 100%);
    background-attachment: fixed;
}

.page-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.card-white {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 8px 24px -8px rgba(15,23,42,.08);
}

/* 标题 */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}
.page-header h1 {
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 800;
    margin: 0 0 .5rem;
    background: linear-gradient(135deg, #1e293b, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.page-header p {
    color: #64748b;
    margin: 0;
    font-size: .95rem;
}

/* 用户区 */
.user-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.user-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
}
.login-area {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}
.login-area input {
    flex: 1;
    min-width: 200px;
    padding: .65rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .95rem;
    background: #fff;
    color: #1e293b;
    transition: all .15s;
}
.login-area input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.login-area button {
    padding: .65rem 1.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-size: .92rem;
}
.login-area button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -6px rgba(99,102,241,.4);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: .75rem;
}
.welcome-text {
    color: #1e293b;
    font-size: .95rem;
}
.logout-btn {
    padding: .5rem 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    font-size: .85rem;
    cursor: pointer;
    transition: all .15s;
}
.logout-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 双栏 */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) {
    .dashboard { grid-template-columns: 1fr; }
}

/* 左栏：房间 */
.left-panel {
    padding: 1.5rem;
}
.room-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
}
.room-input-group {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
}
.room-input-group input {
    flex: 1;
    padding: .6rem .9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .9rem;
}
.room-input-group input:focus {
    outline: none;
    border-color: #6366f1;
}
.room-input-group button {
    padding: .6rem 1.2rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    white-space: nowrap;
}

.room-list-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}
.room-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
    color: #64748b;
    font-size: .82rem;
}
.refresh-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: .35rem .75rem;
    border-radius: 6px;
    font-size: .75rem;
    color: #64748b;
    cursor: pointer;
}
.refresh-btn:hover { background: #e2e8f0; }

.room-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-height: 240px;
    overflow-y: auto;
}
.room-item {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: .75rem;
    cursor: pointer;
    transition: all .15s;
}
.room-item:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}
.room-item.active {
    background: #eef2ff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.room-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .35rem;
}
.room-name span {
    font-weight: 600;
    color: #1e293b;
    font-size: .9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.delete-room {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: .15rem .35rem;
    border-radius: 4px;
    font-size: .75rem;
}
.delete-room:hover { background: #fef2f2; }
.room-status {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .75rem;
    color: #64748b;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.running {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    animation: pulse 1s infinite;
}
.status-dot.paused {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}
.status-dot.stopped { background: #94a3b8; }
.room-time {
    margin-left: auto;
    font-family: monospace;
    color: #6366f1;
    font-weight: 600;
}
.empty-rooms {
    text-align: center;
    padding: 1.5rem;
    color: #94a3b8;
    font-size: .85rem;
}

.room-info {
    margin-top: 1rem;
    padding: .75rem 1rem;
    background: #f8fafc;
    border-radius: 10px;
    color: #64748b;
    font-size: .82rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.room-info strong { color: #1e293b; }
.copy-btn {
    padding: .35rem .75rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .75rem;
    cursor: pointer;
    white-space: nowrap;
}
.copy-btn:hover { background: #4f46e5; }

.display-link {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
}
.display-link a {
    display: inline-block;
    padding: .6rem 1.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 600;
    transition: all .2s;
}
.display-link a:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -6px rgba(99,102,241,.4);
}

/* 右栏：计时器 */
.right-panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.timer-display {
    background: #0f172a;
    border-radius: 20px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 20px 50px -12px rgba(15,23,42,.3);
}
#current-time {
    font-size: 6rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    color: #4dffea;
    text-shadow: 0 0 40px rgba(77,255,234,.5);
    line-height: 1;
    letter-spacing: 4px;
}
.timer-status {
    color: #94a3b8;
    font-size: 1rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
.control-btn {
    padding: 1.25rem .5rem;
    border: none;
    border-radius: 14px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    font-size: .82rem;
}
.control-btn i { font-size: 1.4rem; }
.control-btn:hover { transform: translateY(-2px); }
.control-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#start-btn { background: linear-gradient(135deg, #10b981, #34d399); }
#pause-btn { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
#reset-btn { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
#end-btn   { background: linear-gradient(135deg, #ef4444, #dc2626); }

.time-setter {
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
}
.time-setter h3 {
    font-size: .92rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
}
.time-inputs {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.time-inputs label {
    font-size: .82rem;
    color: #64748b;
    font-weight: 500;
}
.time-inputs input {
    width: 80px;
    padding: .55rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: .92rem;
    text-align: center;
}
.time-inputs input:focus {
    outline: none;
    border-color: #6366f1;
}
#set-time-btn {
    padding: .55rem 1.2rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    margin-left: auto;
}
#set-time-btn:hover { background: #4f46e5; }

/* 状态指示 */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.status-running {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 1s infinite;
}
.status-paused {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}
.status-stopped { background: #94a3b8; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

/* Toast 提示 */
.tn-toast {
    position: fixed;
    bottom: 50%;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: .75rem 1.5rem;
    border-radius: 10px;
    font-size: .88rem;
    z-index: 999999;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    animation: toastIn 0.3s ease;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
}

.tn-toast i {
    margin-right: .5rem;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.hidden { display: none; }

@media (max-width: 600px) {
    #current-time { font-size: 4rem; }
    .controls { grid-template-columns: repeat(2, 1fr); }
}