/* -------------------------------------------------------------
 * Time Glass Pro - Liquid Glass Stylesheet
 * ------------------------------------------------------------- */

/* Custom Fonts & Styling variables */
:root {
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  
  /* Transitions */
  --transition-bouncy: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-smooth: all 0.3s ease;
  
  /* Layout sizes */
  --app-width: 500px;
  --app-height: 600px;
}

/* Theme Configurations */
.theme-amethyst {
  --bg-gradient: linear-gradient(135deg, #0b0114 0%, #17032f 100%);
  --blob1-color: #8a2be2;
  --blob2-color: #ff1493;
  --blob3-color: #4b0082;
  --panel-bg: rgba(22, 6, 38, 0.45);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --accent-color: #ff007f;
  --accent-glow: rgba(255, 0, 127, 0.4);
  --glass-glow: 0 8px 32px 0 rgba(138, 43, 226, 0.25);
}

.theme-solar {
  --bg-gradient: linear-gradient(135deg, #120500 0%, #260a00 100%);
  --blob1-color: #ff8c00;
  --blob2-color: #ff3c00;
  --blob3-color: #8b0000;
  --panel-bg: rgba(38, 12, 4, 0.45);
  --panel-border: rgba(255, 255, 255, 0.15);
  --text-primary: #fff2e6;
  --text-secondary: rgba(255, 242, 230, 0.65);
  --accent-color: #ff9f1a;
  --accent-glow: rgba(255, 159, 26, 0.4);
  --glass-glow: 0 8px 32px 0 rgba(255, 60, 0, 0.25);
}

.theme-aurora {
  --bg-gradient: linear-gradient(135deg, #001010 0%, #002220 100%);
  --blob1-color: #00fa9a;
  --blob2-color: #00ffff;
  --blob3-color: #008080;
  --panel-bg: rgba(4, 38, 36, 0.45);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text-primary: #e6ffff;
  --text-secondary: rgba(230, 255, 255, 0.65);
  --accent-color: #00ffcc;
  --accent-glow: rgba(0, 255, 204, 0.4);
  --glass-glow: 0 8px 32px 0 rgba(0, 250, 154, 0.25);
}

.theme-obsidian {
  --bg-gradient: linear-gradient(135deg, #080808 0%, #151515 100%);
  --blob1-color: #333333;
  --blob2-color: #666666;
  --blob3-color: #222222;
  --panel-bg: rgba(28, 28, 28, 0.55);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.5);
  --accent-color: #ffffff;
  --accent-glow: rgba(255, 255, 255, 0.2);
  --glass-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-drag: none;
}

body {
  font-family: var(--font-display);
  background: var(--bg-gradient);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: var(--transition-smooth);
}

/* Liquid Blob Background */
.liquid-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  filter: url('#liquid-glass-filter');
}

.blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0.65;
  will-change: transform, left, top;
}

.blob1 {
  width: 500px;
  height: 500px;
  background: var(--blob1-color);
  left: -100px;
  top: -100px;
  animation: moveBlob1 18s infinite alternate ease-in-out;
}

.blob2 {
  width: 450px;
  height: 450px;
  background: var(--blob2-color);
  right: -50px;
  bottom: -50px;
  animation: moveBlob2 22s infinite alternate ease-in-out;
}

.blob3 {
  width: 350px;
  height: 350px;
  background: var(--blob3-color);
  left: 30%;
  top: 40%;
  animation: moveBlob3 25s infinite alternate ease-in-out;
}

@keyframes moveBlob1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(120px, 80px) scale(1.1); }
  100% { transform: translate(60px, 150px) scale(0.9); }
}

@keyframes moveBlob2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-100px, -120px) scale(0.85); }
  100% { transform: translate(-50px, -60px) scale(1.1); }
}

@keyframes moveBlob3 {
  0% { transform: translate(0, 0) scale(0.9); }
  50% { transform: translate(80px, -80px) scale(1.2); }
  100% { transform: translate(-80px, 80px) scale(0.95); }
}

/* Glass App Panel Layout */
.glass-panel {
  width: calc(100vw - 48px);
  height: calc(100vh - 48px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-glow);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-radius: 32px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: var(--transition-smooth);
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
}

.app-logo h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

/* Navigation Tabs */
.tab-navigation {
  display: flex;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 99px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 24px;
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Icon Buttons */
.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-bouncy);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1) rotate(15deg);
}

.icon-btn:active {
  transform: scale(0.9);
}

/* Tab Panels Content */
.tab-content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  position: relative;
}

.tab-pane {
  display: none;
  height: 100%;
  flex-direction: column;
}

.tab-pane.active {
  display: flex;
}

/* Clock Tab Styles */
#clock-tab {
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.clock-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
}

.time-text {
  font-family: var(--font-mono);
  font-size: 8.5vw;
  font-weight: 400;
  letter-spacing: -3px;
  text-shadow: 0 10px 40px var(--accent-glow);
}

.ms-text {
  font-family: var(--font-mono);
  font-size: 3.5vw;
  color: var(--accent-color);
  opacity: 0.85;
  margin-left: 8px;
  width: 9vw; /* Prevent jitter */
  transition: opacity 0.3s ease;
}

.ms-text.hidden {
  opacity: 0;
  width: 0px;
  pointer-events: none;
}

.clock-date {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.quick-controls {
  margin-top: 32px;
}

/* Glass Buttons */
.glass-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: var(--transition-bouncy);
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.glass-btn:active {
  transform: translateY(1px);
}

.glass-btn.primary {
  background: var(--accent-color);
  border-color: transparent;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.glass-btn.primary:hover {
  background: var(--accent-color);
  opacity: 0.9;
  box-shadow: 0 6px 20px var(--accent-glow);
}

.glass-btn.small {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}

.glass-btn.large {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: 16px;
}

/* Alarms Tab Layout */
.alarms-header, .timers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.alarms-header h2, .timers-header h2 {
  font-size: 20px;
  font-weight: 500;
}

.alarms-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  align-content: start;
  flex: 1;
}

.no-items-message {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin: auto;
  max-width: 280px;
  line-height: 1.5;
}

/* Glass Card */
.glass-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px 20px;
  backdrop-filter: blur(15px);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

/* Alarm Card */
.alarm-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alarm-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alarm-time-wrapper {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.alarm-time {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 400;
}

.alarm-period {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-color);
}

.alarm-meta {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 300;
}

.alarm-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Switches (Toggles) */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: var(--accent-color);
  border-color: transparent;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Input pickers & forms */
#alarm-form, #timer-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
  animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

#alarm-form.hidden, #timer-form.hidden {
  display: none;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}

.alarm-picker, .timer-picker {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.picker-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.picker-group label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.picker-group input, .picker-group select {
  width: 65px;
  height: 50px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-primary);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  outline: none;
  transition: var(--transition-smooth);
}

.picker-group input:focus, .picker-group select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-glow);
}

.picker-group select {
  font-family: var(--font-display);
  font-size: 16px;
  width: 75px;
  padding: 0 4px;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
}

.form-row label {
  font-size: 14px;
  color: var(--text-secondary);
}

.form-row input[type="text"], .form-row select {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: 14px;
  outline: none;
  text-align: right;
  min-width: 140px;
}

.form-row input[type="text"]:focus, .form-row select:focus {
  border-color: var(--accent-color);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-actions button {
  flex: 1;
}

/* Timers Grid */
.timers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  align-content: start;
  flex: 1;
}

.timer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.timer-visual {
  position: relative;
  width: 60px;
  height: 60px;
}

.timer-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 4;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
  filter: drop-shadow(0 0 3px var(--accent-color));
}

.timer-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
}

.timer-info-main {
  flex: 1;
  margin-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timer-countdown {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 400;
}

.timer-duration-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.timer-controls {
  display: flex;
  gap: 8px;
}

/* Overlay & Ring Modal */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(15px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease forwards;
}

.overlay.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ring-card {
  width: 320px;
  text-align: center;
  padding: 32px 24px;
  box-shadow: var(--glass-glow);
  animation: scaleUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.ring-bell {
  font-size: 48px;
  margin-bottom: 16px;
  animation: bellShake 1.2s infinite ease-in-out;
}

@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(15deg); }
  30% { transform: rotate(-15deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  75% { transform: rotate(4deg); }
  90% { transform: rotate(-4deg); }
}

#ring-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

#ring-time {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Sliding Settings Menu */
.settings-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: rgba(10, 2, 20, 0.7);
  border-left: 1px solid var(--panel-border);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
}

.settings-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-header h2 {
  font-size: 18px;
  font-weight: 500;
}

.drawer-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.setting-row.volume-control {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.setting-row.volume-control input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 4px;
  border-radius: 99px;
  outline: none;
}

.setting-row.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid var(--accent-color);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: var(--transition-smooth);
}

.setting-row.volume-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Theme Option grid */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.theme-option {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.theme-option:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.theme-option.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
  color: var(--text-primary);
}

.theme-preview {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.theme-option.amethyst .theme-preview { background: #8a2be2; }
.theme-option.solar .theme-preview { background: #ff8c00; }
.theme-option.aurora .theme-preview { background: #00fa9a; }
.theme-option.obsidian .theme-preview { background: #666666; }

/* Custom Scrollbar for Drawer/Tab panes */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
