/* Modern CSS Styles using Design System */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    /* background: var(--background); Let the ribbons container handle the background */
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: var(--foreground);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header p {
    font-size: 1.1rem;
    color: var(--muted-foreground);
    font-weight: 400;
}

.grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin-bottom: 24px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.card {
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

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

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header i {
    font-size: 1.5rem;
    margin-right: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 120px;
    gap: 8px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    filter: brightness(1.1);
}

.btn-success {
    background: var(--chart-3);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--destructive);
    color: var(--destructive-foreground);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    background: var(--muted);
    color: var(--muted-foreground);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled::before {
    display: none;
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
}

.toggle-btn:hover {
    background: var(--muted);
    border-color: var(--primary);
}

.toggle-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.status {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 8px;
}

.status-connected {
    background: linear-gradient(135deg, var(--chart-3), var(--accent));
    color: var(--chart-3);
    border: 1px solid var(--chart-3);
}

.status-disconnected {
    background: linear-gradient(135deg, var(--destructive), var(--muted));
    color: var(--destructive);
    border: 1px solid var(--destructive);
}

.status i {
    font-size: 0.875rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.form-control {
    padding: 12px 16px;
    border: 2px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--background);
    color: var(--foreground);
}

.form-control:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(var(--ring), 0.1);
}

.form-control:disabled {
    background: var(--muted);
    color: var(--muted-foreground);
    cursor: not-allowed;
}

.progress-container {
    margin: 20px 0;
}

.progress {
    width: 100%;
    height: 12px;
    background: var(--muted);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.log {
    background: var(--card);
    color: var(--foreground);
    border-radius: var(--radius);
    padding: 20px;
    height: 300px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    border: 1px solid var(--border);
    position: relative;
}

.log::-webkit-scrollbar {
    width: 8px;
}

.log::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: 4px;
}

.log::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.log::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.status-group {
    background: var(--muted);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.status-group h4 {
    margin: 0 0 16px 0;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0;
    font-size: 0.875rem;
}

.status-item strong {
    color: var(--muted-foreground);
    font-weight: 500;
}

.status-item span {
    color: var(--primary);
    font-weight: 600;
}

.temp-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.preset-card {
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.preset-card:hover {
    border-color: var(--ring);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.preset-card.heating-disabled {
    opacity: 0.6;
    pointer-events: none;
    background: var(--muted);
}

.preset-card.selected {
    background: #e6f9ec;        /* 浅绿色背景 */
    border-color: #4caf50;      /* 绿色边框 */
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3); /* 绿色阴影 */
    transform: translateY(-2px); /* 轻微上移效果 */
}



.preset-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.temp-input {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 8px 0;
    font-family: var(--font-sans);
}

.temp-input:focus {
    outline: none;
}

.temp-container {
    display: inline-flex;
    align-items: center;
}

.temp-unit {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--muted);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--background);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

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

.led-selector {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.led-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* LED Color Classes */
.led-preview.clam { background: #f5f5f5; border-color: #ccc; }
.led-preview.stealth { background: #2d3748; }
.led-preview.purple { background: #805ad5; }
.led-preview.blue { background: #3182ce; }
.led-preview.cyan { background: #00b5d8; }
.led-preview.green { background: #38a169; }
.led-preview.yellow { background: #d69e2e; }
.led-preview.orange { background: #dd6b20; }
.led-preview.red { background: #e53e3e; }
.led-preview.pink { background: #d53f8c; }
.led-preview.cali-sunset { background: linear-gradient(45deg, #ff6b6b, #ffa500); }
.led-preview.purple-haze { background: linear-gradient(45deg, #9f7aea, #b794f6); }
.led-preview.northern-nights { background: linear-gradient(45deg, #2d3748, #4a5568); }
.led-preview.vegas-nights { background: linear-gradient(45deg, #ed8936, #f6ad55); }
.led-preview.blue-dream { background: linear-gradient(45deg, #3182ce, #63b3ed); }
.led-preview.strawberry-cough { background: linear-gradient(45deg, #e53e3e, #fc8181); }
.led-preview.florida-groves { background: linear-gradient(45deg, #38a169, #68d391); }
.led-preview.lime-light { background: linear-gradient(45deg, #68d391, #9ae6b4); }

.responsive-table {
    overflow-x: auto;
    margin: 16px 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--muted);
    font-weight: 600;
    color: var(--foreground);
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    min-width: 300px;
    color: var(--foreground);
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    border-left-color: var(--destructive);
}

.notification.warning {
    border-left-color: var(--chart-3);
}

.notification.info {
    border-left-color: var(--chart-1);
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.connected {
    background: var(--chart-3);
    animation: pulse 2s infinite;
}

.status-indicator.disconnected {
    background: var(--destructive);
}

.status-indicator.connecting {
    background: var(--chart-3);
    animation: spin 1s linear infinite;
}

/* Animations */
.pulse {
    animation: pulse 2s infinite;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.spinning {
    animation: spin 1s linear infinite;
}

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

.bounce {
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.progress-bar.pulse {
    animation: progressPulse 1.5s infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.heating-active .preset-card {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-color: var(--chart-3);
}

.heating-active .preset-card::after {
    content: "🔥";
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.875rem;
}

.preset-card:hover .temp-input {
    color: var(--primary);
}

.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    color: var(--foreground);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.tooltip:hover::after {
    opacity: 1;
}

.loading {
    position: relative;
    pointer-events: none;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

.loading * {
    opacity: 0.5;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dark {
        /* Dark mode styles are already defined in design.css */
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 20px 16px;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .temp-preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .temp-preset-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Ribbons Background Effect */
#ribbons-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Place it behind all other content */
    pointer-events: none; /* Make sure it doesn't interfere with mouse events */
    background: var(--background); /* Set the background color here */
}

/* Circular Text Title */
.circular-text-container {
    width: 250px; /* Increased size */
    height: 250px;
    position: relative;
    margin: 0 auto 20px; /* Add some margin bottom */
    color: var(--primary);
    animation: spin 30s linear infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

.circular-text-container span {
    position: absolute;
    left: 50%;
    top: 0;
    transform-origin: 0 125px; /* half of width/height */
    height: 125px;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Star border button effect */
.star-border-container {
    --star-color: white;
    --star-speed: 6s;
    display: inline-block;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
}

.star-border-container .border-gradient-bottom,
.star-border-container .border-gradient-top {
    position: absolute;
    width: 300%;
    height: 50%;
    opacity: 0.7;
    border-radius: 50%;
    pointer-events: none;
    animation-duration: var(--star-speed);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    z-index: 0;
    background: radial-gradient(circle, var(--star-color), transparent 10%);
}

.star-border-container .border-gradient-bottom {
    bottom: -12px;
    right: -250%;
    animation-name: star-movement-bottom;
}

.star-border-container .border-gradient-top {
    top: -12px;
    left: -250%;
    animation-name: star-movement-top;
}

.star-border-container .inner-content {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@keyframes star-movement-bottom {
    0% {
        transform: translate(0%, 0%);
        opacity: 1;
    }
    100% {
        transform: translate(-100%, 0%);
        opacity: 0;
    }
}

@keyframes star-movement-top {
    0% {
        transform: translate(0%, 0%);
        opacity: 1;
    }
    100% {
        transform: translate(100%, 0%);
        opacity: 0;
    }
}

/* 认证界面样式 */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    margin: 20px;
}

.auth-card h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
    font-family: 'Oxanium', monospace;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-buttons .btn {
    flex: 1;
}

.auth-switch-text {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.auth-switch-text p {
    margin: 5px 0;
}

.auth-message {
    padding: 10px;
    margin: 15px 0;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
}

.auth-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.auth-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 用户信息栏 */
.user-info-bar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.user-info-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* 上传状态样式 */
.upload-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.upload-status.ready {
    background: rgba(108, 117, 125, 0.2);
    color: #6c757d;
}

.upload-status.success {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.upload-status.error {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.upload-status.uploading {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}
