/* ============================================
   寝室值日抽签系统 - 升级版UI样式
   ============================================ */

/* CSS变量 */
:root {
    --color-primary: #FF6B6B;
    --color-primary-dark: #E85555;
    --color-secondary: #4ECDC4;
    --color-secondary-dark: #3DBDB5;
    --color-accent: #FFE66D;
    --color-accent-dark: #E6CF62;
    --color-text: #2D3436;
    --color-text-light: #636E72;
    --color-bg: #F7F5F2;
    --color-bg-gradient: linear-gradient(135deg, #F7F5F2 0%, #EBE8E5 100%);
    --color-card: #FFFFFF;
    --color-gray: #B2BEC3;
    --color-light-gray: #DFE6E9;
    --color-success: #00B894;
    --color-warning: #FDCB6E;
    --color-danger: #E17055;
    
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 50%;
    
    --shadow-soft: 0 4px 12px rgba(45, 52, 54, 0.08);
    --shadow-medium: 0 8px 24px rgba(45, 52, 54, 0.12);
    --shadow-hard: 4px 4px 0px var(--color-text);
    --shadow-glow: 0 0 20px rgba(255, 107, 107, 0.3);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei UI', 'YouYuan', sans-serif;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-bg);
    background-image: var(--color-bg-gradient);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 页面容器 */
.page-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    text-align: center;
    padding: 24px 0;
}

.logo {
    font-size: 1.8rem;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #FF8E8E 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* 卡片样式 */
.card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary), var(--color-accent));
    opacity: 0;
    transition: var(--transition-normal);
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.card-title {
    font-size: 1rem;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    width: 100%;
    position: relative;
    font-family: inherit;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.5);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-accent {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    color: var(--color-text);
    box-shadow: 0 4px 15px rgba(255, 230, 109, 0.4);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 230, 109, 0.5);
}

.btn-outline {
    background: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-light-gray);
}

.btn-outline:hover {
    background: var(--color-light-gray);
    border-color: var(--color-gray);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 按钮组 */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding-top: 16px;
}

/* 输入框 */
.input-group {
    margin-bottom: 14px;
}

.input-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-weight: 600;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 500;
    border: 2px solid var(--color-light-gray);
    border-radius: var(--radius-md);
    background: var(--color-card);
    transition: var(--transition-fast);
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.input-field::placeholder {
    color: var(--color-gray);
    font-weight: 500;
}

/* 数字输入 */
.number-input {
    display: flex;
    align-items: center;
    gap: 16px;
}

.number-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-light-gray) 0%, #D0D5DA 100%);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    color: var(--color-text);
}

.number-btn:hover {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    transform: scale(1.05);
}

.number-btn:active {
    transform: scale(0.95);
}

.number-value {
    font-size: 1.5rem;
    min-width: 50px;
    text-align: center;
    font-weight: 700;
    color: var(--color-text);
}

/* 房间信息 */
.room-info {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CC 100%);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 2px solid transparent;
}

.room-info:hover {
    border-color: var(--color-accent);
    transform: scale(1.01);
}

.room-info:active {
    transform: scale(0.99);
}

.room-code-display {
    font-size: 1.3rem;
    font-weight: 800;
    font-family: 'SF Mono', 'Courier New', monospace;
    letter-spacing: 4px;
    color: var(--color-text);
}

.room-status {
    font-size: 0.75rem;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-warning);
    font-weight: 700;
}

.room-status.locked {
    background: var(--color-success);
    color: white;
}

/* 倒计时 */
.countdown {
    text-align: center;
    padding: 14px;
    background: linear-gradient(135deg, #FFF0F0 0%, #FFE8E8 100%);
    border-radius: var(--radius-md);
    margin: 14px 0;
    border: 1px dashed var(--color-primary);
}

.countdown-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 4px;
}

.countdown-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* 成员列表 */
.member-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--color-card);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    animation: slideIn 0.3s ease;
    border: 1px solid var(--color-light-gray);
}

.member-item:hover {
    background: var(--color-light-gray);
    transform: translateX(4px);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.member-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.member-name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
}

.member-tag {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    font-weight: 700;
}

.member-tag.owner {
    background: linear-gradient(135deg, #FFD93D 0%, #FF8E53 100%);
    color: var(--color-text);
}

.member-tag:not(.owner) {
    background: var(--color-light-gray);
    color: var(--color-text-light);
}

.full-hint {
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 217, 61, 0.15) 0%, rgba(255, 107, 107, 0.15) 100%);
    border-radius: var(--radius-md);
    margin-top: 10px;
    border: 2px dashed var(--color-accent);
    font-size: 0.9rem;
    color: var(--color-text);
    font-weight: 700;
    animation: pulse 2s ease-in-out infinite;
}

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

/* 任务卡片 */
.task-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid var(--color-light-gray);
    position: relative;
    overflow: hidden;
}

.task-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 30px 30px 0;
    border-color: transparent var(--color-secondary) transparent transparent;
    opacity: 0;
    transition: var(--transition-fast);
}

.task-card:hover {
    border-color: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.task-card:hover::after {
    opacity: 1;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.task-title {
    font-size: 1rem;
    font-weight: 700;
}

.task-status {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    background: var(--color-light-gray);
    font-weight: 700;
}

.task-status.ready {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
    color: white;
}

.task-info {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* 抽签页面 */
.draw-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.draw-title {
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: 6px;
}

.draw-status-text {
    margin-top: 20px;
    font-size: 1rem;
    color: var(--color-text-light);
}

/* 盲盒动画 */
.blind-box {
    width: 140px;
    height: 140px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #FF8E8E 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    box-shadow: var(--shadow-medium);
    animation: bounce 0.6s ease-in-out infinite;
    position: relative;
}

.blind-box::before {
    content: '?';
    position: absolute;
    font-size: 3rem;
    font-weight: 800;
    color: white;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

/* 倒计时动画 */
.countdown-display {
    font-size: 7rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary) 0%, #FF8E8E 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countPulse 0.5s ease-in-out;
    text-shadow: none;
}

@keyframes countPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* 结果展示 */
.result-container {
    text-align: center;
    padding: 20px;
}

.result-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--color-text);
}

.result-members {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-bottom: 20px;
}

.result-member {
    background: var(--color-card);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    box-shadow: var(--shadow-medium);
    animation: popIn 0.5s ease;
    border: 2px solid var(--color-secondary);
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-10deg);
    }
    70% {
        transform: scale(1.1) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.result-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.result-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.result-message {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 20px;
    font-weight: 700;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(78, 205, 196, 0.1) 100%);
    border-radius: var(--radius-md);
}

/* 历史记录 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--color-card);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-secondary);
}

.history-date {
    font-size: 0.75rem;
    color: var(--color-gray);
    min-width: 50px;
}

.history-task {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
}

.history-member {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.history-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 30px 16px;
    color: var(--color-gray);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-text {
    font-size: 0.9rem;
}

.empty-hint {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 6px;
}

/* 提示信息 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--color-text);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-medium);
    max-width: 90%;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: linear-gradient(135deg, var(--color-success) 0%, #00A884 100%);
}

.toast.error {
    background: linear-gradient(135deg, var(--color-danger) 0%, #D63031 100%);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 彩纸特效 */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* 页面切换动画 */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 返回按钮 */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    color: var(--color-text-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    background: none;
    border: none;
    font-family: inherit;
    font-weight: 600;
}

.back-btn:hover {
    color: var(--color-primary);
    transform: translateX(-4px);
}

/* 响应式 */
@media (max-width: 480px) {
    .page-container {
        padding: 14px;
    }
    
    .header {
        padding: 20px 0;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 16px;
    }
    
    .room-code-display {
        font-size: 1.1rem;
        letter-spacing: 3px;
    }
    
    .countdown-display {
        font-size: 5rem;
    }
    
    .btn {
        padding: 12px 20px;
    }
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 触摸友好 */
@media (hover: none) {
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-soft);
    }
    
    .card:hover::before {
        opacity: 0;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .task-card:hover {
        transform: none;
        box-shadow: var(--shadow-soft);
    }
    
    .member-item:hover {
        transform: none;
        background: var(--color-card);
    }
}
