/* css/style.css (전체 덮어쓰기) */

/* --- 0. 색상 변수 정의 --- */
:root {
  /* 라이트 모드 */
  --bg-color: #f4f7f6;
  --bg-secondary-color: #ffffff;
  --text-color: #333;
  --text-secondary-color: #555;
  --border-color: #e0e0e0;
  --card-shadow: 0 2px 4px rgba(0,0,0,0.05);
  --dryer-bg-color: #fffaf0; 

  /* 버튼 색상 */
  --primary-color: #0064FF; 
  --primary-hover-color: #0050CC;
  --cta-color: #5cb85c; 
  --cta-hover-color: #4cae4c;
  --cta-subscribed-color: #f0ad4e; 
  --cta-subscribed-hover: #ec971f;
  --btn-disabled-bg: #6c757d;
  
  /* 상태별 색상 */
  --status-off-border: #6c757d;
  --status-off-text: #6c757d;
  --status-washing-border: #007bff;
  --status-washing-text: #007bff;
  --status-spinning-border: #ffc107;
  --status-spinning-text: #d39e00;
  --status-finished-border: #28a745;
  --status-finished-text: #28a745;
}

body.dark-mode {
  /* 다크 모드 */
  --bg-color: #121212;
  --bg-secondary-color: #1e1e1e;
  --text-color: #e0e0e0;
  --text-secondary-color: #b0b0b0;
  --border-color: #333;
  --card-shadow: 0 2px 4px rgba(0,0,0,0.2);
  --dryer-bg-color: #2c251a; 

  --primary-color: #0084ff; 
  --primary-hover-color: #0060C0;
  --cta-color: #5cb85c; 
  --cta-hover-color: #4cae4c;
  --cta-subscribed-color: #f0ad4e; 
  --cta-subscribed-hover: #ec971f;
  --btn-disabled-bg: #444;

  --status-off-border: #5a5a5a;
  --status-off-text: #888;
  --status-washing-border: #0084ff;
  --status-washing-text: #0084ff;
  --status-spinning-border: #ffc107;
  --status-spinning-text: #ffc107;
  --status-finished-border: #30c050;
  --status-finished-text: #30c050;
}


/* --- 1. 기본 레이아웃 --- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  margin: 0;
  padding-bottom: 50px;
  color: var(--text-color);
  transition: background-color 0.2s, color 0.2s;
}

.container {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 20px;
}

/* --- 2. 네비게이션 바 --- */
.navbar {
  background-color: var(--bg-secondary-color);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  box-shadow: var(--card-shadow);
  transition: background-color 0.2s;
}
.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
}
.navbar-nav {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  z-index: 1000;
}
.navbar-nav li {
  margin-left: 20px;
  display: flex;
  align-items: center;
}
.navbar-nav a {
  text-decoration: none;
  color: var(--text-secondary-color);
  font-weight: 500;
  transition: color 0.2s;
}
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-color);
}

/* --- 3. 헤더 --- */
.main-header {
  text-align: center;
  margin-bottom: 30px;
}
.main-header h2 {
  font-size: 2rem;
  color: var(--text-color);
  margin-bottom: 10px;
}
.main-header p {
  font-size: 1.1rem;
  color: var(--text-secondary-color);
}

/* --- 4. 세탁기 리스트 --- */
#machine-list-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* --- 5. 세탁기 카드 --- */
.machine-card {
  background-color: var(--bg-secondary-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
  border-left: 5px solid #ccc;
}
.machine-card h3 {
  margin-top: 0;
  color: var(--text-color);
}
.status-display {
  font-size: 1rem;
  color: var(--text-secondary-color);
  margin-bottom: 5px;
}
.status-display strong {
  font-size: 1.1rem;
  font-weight: bold;
}

/* --- 6. 상태별 디자인 --- */
.status-off { border-left-color: var(--status-off-border); opacity: 0.8; }
.status-off .status-display strong { color: var(--status-off-text); }
.status-washing { border-left-color: var(--status-washing-border); }
.status-washing .status-display strong { color: var(--status-washing-text); }
.status-spinning { border-left-color: var(--status-spinning-border); animation: shake 0.5s infinite; }
.status-spinning .status-display strong { color: var(--status-spinning-text); }
.status-finished { border-left-color: var(--status-finished-border); }
.status-finished .status-display strong { color: var(--status-finished-text); }
.status-drying { border-left-color: var(--status-spinning-border); animation: shake 0.5s infinite; }
.status-drying .status-display strong { color: var(--status-spinning-text); }

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-1px, 0px) rotate(1deg); }
  30% { transform: translate(1px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-1px, 1px) rotate(0deg); }
  70% { transform: translate(1px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* --- 9. 로그인 / 회원가입 폼 --- */
.auth-container {
  max-width: 450px;
  margin: 50px auto;
  padding: 30px;
  background-color: var(--bg-secondary-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}
.auth-form h2 {
  text-align: center;
  color: var(--text-color);
  margin-bottom: 25px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary-color);
}
.form-group input {
  width: 100%;
  padding: 12px;
  box-sizing: border-box; 
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-color);
  border-radius: 5px;
  font-size: 1rem;
}
.auth-button {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}
.auth-button:hover {
  background-color: var(--primary-hover-color);
}
.auth-toggle {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary-color);
}
.auth-toggle a {
  color: var(--primary-color);
  font-weight: 500;
  text-decoration: none;
}

/* --- 10. ❗️ [복구] 혼잡도 요일 버튼 (정렬 수정됨) --- */
.day-selector {
  display: flex;
  justify-content: center; /* 중앙 정렬 */
  gap: 8px; /* 간격 */
  margin-bottom: 20px;
  flex-wrap: nowrap; /* 줄바꿈 방지 */
}
.day-btn {
  flex: 1; /* 균등 너비 */
  padding: 10px 0;
  font-size: 1rem;
  text-align: center;
  border: 1px solid var(--primary-color);
  background-color: var(--bg-secondary-color);
  color: var(--primary-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 60px; /* 너무 커지지 않게 제한 */
}
.day-btn:hover {
  background-color: var(--bg-color);
}
.day-btn.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- 11. ❗️ [복구] 서베이 폼 --- */
.survey-form {
  background-color: var(--bg-secondary-color);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
}
.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.radio-group input[type="radio"] { display: none; }
.radio-group label {
    display: flex; align-items: center; justify-content: center;
    padding: 12px 10px; font-weight: 500; font-size: 0.95rem;
    color: var(--text-secondary-color);
    background-color: var(--bg-secondary-color);
    border-left: 1px solid var(--border-color);
    cursor: pointer; transition: all 0.2s;
    text-align: center; white-space: nowrap;
}
.radio-group label:first-of-type { border-left: none; }
.radio-group label:hover { background-color: var(--bg-color); }
.radio-group input[type="radio"]:checked + label {
    background-color: var(--primary-color);
    color: white; font-weight: 600;
}
.form-group textarea, .form-group select {
  width: 100%; padding: 12px; box-sizing: border-box; 
  border: 1px solid var(--border-color);
  background-color: var(--bg-color); color: var(--text-color);
  border-radius: 5px; font-size: 1rem; resize: vertical;
}
.submit-btn {
    padding: 12px 20px; font-size: 1rem; font-weight: 600;
    background-color: var(--primary-color); color: white;
    border: none; border-radius: 5px; cursor: pointer;
    transition: background-color 0.2s;
}
.submit-btn:hover { background-color: var(--primary-hover-color); }

/* --- 12. ❗️ [복구] 푸시 컨테이너 --- */
.push-container {
  background-color: var(--bg-secondary-color);
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
  text-align: center;
}

/* --- 13. ❗️ [복구] 에러 메시지 --- */
.error-message {
  color: #D8000C;
  background-color: #FFD2D2;
  border: 1px solid #D8000C;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 15px;
  text-align: center;
  font-weight: 500;
  display: none;
}

/* --- 15. 서버 연결 상태 --- */
.status-alert {
  padding: 15px;
  border-radius: 5px;
  text-align: center;
  font-weight: bold;
  margin-bottom: 20px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.status-alert.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.status-alert.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* --- 16. 팁 컨테이너 --- */
.tip-container {
    background-color: rgba(0, 123, 255, 0.1);
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex; 
    align-items: flex-start;
    gap: 15px; 
    font-size: 1rem;
    color: var(--primary-color);
    line-height: 1.5;
}
.tip-container::before {
    content: '💡';
    font-size: 1.5rem;
    line-height: 1;
}

/* --- 17. 빈자리 알림 버튼 --- */
#room-subscribe-button {
    background-color: var(--cta-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: background-color 0.3s ease;
    width: 80%;
    max-width: 400px;
}
#room-subscribe-button:hover {
    background-color: var(--cta-hover-color);
}
#room-subscribe-button.subscribed {
    background-color: var(--cta-subscribed-color);
}
#room-subscribe-button.subscribed:hover {
    background-color: var(--cta-subscribed-hover);
}
#room-subscribe-button:disabled {
    background-color: var(--btn-disabled-bg);
    cursor: not-allowed;
}

/* --- 18. 개별 카드 알림 버튼 --- */
.notify-start-btn,
.notify-me-during-wash-btn {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    font-weight: 600;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 15px;
}
.notify-start-btn:hover,
.notify-me-during-wash-btn:hover {
    background-color: var(--primary-hover-color);
}
.notify-start-btn:disabled,
.notify-me-during-wash-btn:disabled {
    background-color: var(--btn-disabled-bg);
    cursor: not-allowed;
    opacity: 0.8;
}

/* --- 21. 건조기 카드 --- */
.machine-type-dryer {
    background-color: var(--dryer-bg-color);
    border-color: var(--border-color);
}

/* --- 23. 타이머 UI --- */
.timer-display {
    font-size: 0.95rem;
    color: var(--text-secondary-color);
    background-color: var(--bg-color);
    border-radius: 5px;
    padding: 10px;
    border: 1px solid var(--border-color);
    margin-top: 10px; 
}
.timer-row {
    display: flex;
    justify-content: space-between;
    line-height: 1.6;
}
.timer-row span:first-child {
    font-weight: 500;
    color: var(--text-secondary-color);
}
.timer-row span:last-child {
    font-weight: bold;
    color: var(--primary-color);
}
.timer-row.total-time {
    font-size: 1.05rem;
    margin-bottom: 4px;
}
.timer-row.total-time span:last-child {
    color: var(--text-color);
}

/* --- 25. 다크 모드 토글 스위치 --- */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  margin-left: 20px;
}
.theme-switch {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 44px;
}
.theme-switch input {
  display: none;
}
.theme-slider {
  background-color: #ccc;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: .4s;
  border-radius: 24px;
}
.theme-slider:before {
  background-color: #fff;
  bottom: 3px;
  content: "";
  height: 18px;
  left: 3px;
  position: absolute;
  transition: .4s;
  width: 18px;
  border-radius: 50%;
}
input:checked + .theme-slider {
  background-color: var(--primary-color);
}
input:checked + .theme-slider:before {
  transform: translateX(20px);
}

/* --- 26. 모달 UI --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}
.modal-content {
    background-color: var(--bg-secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: slideUp 0.3s ease-out;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}
.close-modal {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary-color);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.modal-content p {
    color: var(--text-secondary-color);
    margin-bottom: 20px;
    font-size: 0.95rem;
}
.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.modal-course-btn {
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    background-color: var(--bg-color);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.modal-course-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}
.modal-course-btn:active {
    transform: translateY(0);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

/* --- 모바일 반응형 --- */
@media (max-width: 768px) {
  .navbar-toggle { display: block; }
  .navbar-nav {
    position: fixed; 
    top: 0; right: 0; width: 250px; height: 100vh;
    display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform 0.3s;
    background-color: var(--bg-secondary-color);
    padding-top: 60px;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
  }
  .navbar-nav.active { transform: translateX(0%); }
  .navbar-nav li { margin: 0; width: 100%; }
  .navbar-nav a { display: block; padding: 15px 25px; border-bottom: 1px solid var(--border-color); }
  
  .theme-switch-wrapper {
      padding: 15px 25px;
      justify-content: space-between;
      border-bottom: 1px solid var(--border-color);
  }
  
  /* 요일 버튼 모바일 조정 */
  .day-selector {
    gap: 5px; 
  }
  .day-btn {
    font-size: 0.9rem;
    padding: 8px 0;
  }
}