:root {
    --primary-bg: #0f0f1a;
    --card-bg: #1a1a2e;
    --card-bg-hover: #252542;
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --success: #00d9a5;
    --warning: #ffb800;
    --danger: #ff4757;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    --border: rgba(255, 255, 255, 0.08);
    --card-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(108, 99, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 217, 165, 0.1) 0%, transparent 50%),
        linear-gradient(180deg, var(--primary-bg) 0%, #0a0a12 100%);
    z-index: -1;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px 100px;
    min-height: 100vh;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    background: rgba(15, 15, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #8b80ff);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.refresh-btn {
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.refresh-btn:active {
    transform: scale(0.95);
    background: var(--card-bg-hover);
}

.refresh-btn i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.refresh-btn.spinning i {
    animation: spin 1s linear infinite;
}

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

/* Main Content */
.main-content {
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Status Cards */
.status-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.status-card:active {
    transform: scale(0.99);
}

.status-card.wide {
    flex-direction: column;
    align-items: stretch;
}

.status-card.connection-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(108, 99, 255, 0.1) 100%);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: rgba(108, 99, 255, 0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-info h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.card-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status Badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    flex-shrink: 0;
}

.status-badge.online .status-dot {
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
}

.status-badge.offline .status-dot {
    background: var(--danger);
    box-shadow: 0 0 12px var(--danger);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

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

.status-badge span:last-child {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Card Details */
.card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.battery-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.battery-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease, background 0.3s ease;
}

.card-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 16px;
}

.card-header i {
    width: 36px;
    height: 36px;
    background: rgba(108, 99, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--accent);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

.card-header.clickable {
    cursor: pointer;
    margin-bottom: 0;
}

.card-header.clickable:active {
    opacity: 0.8;
}

.expand-icon {
    transition: transform 0.3s ease;
    color: var(--text-muted);
    font-size: 12px;
}

.card-header.expanded .expand-icon {
    transform: rotate(180deg);
}

.card-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.card-content.show {
    max-height: 200px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.card-content code {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.6;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

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

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    transition: var(--transition);
}

.feature-item.active {
    background: rgba(0, 217, 165, 0.1);
}

.feature-item.inactive {
    opacity: 0.4;
}

.feature-item i {
    font-size: 20px;
    color: var(--success);
}

.feature-item.inactive i {
    color: var(--text-muted);
}

.feature-item span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Storage List */
.storage-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.storage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.storage-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.storage-size {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 20px;
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, var(--primary-bg) 50%, transparent);
    text-align: center;
}

.app-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    font-size: 40px;
    color: var(--accent);
    animation: spin 1s linear infinite;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-card {
    animation: fadeInUp 0.4s ease backwards;
}

.status-card:nth-child(1) { animation-delay: 0.05s; }
.status-card:nth-child(2) { animation-delay: 0.1s; }
.status-card:nth-child(3) { animation-delay: 0.15s; }
.status-card:nth-child(4) { animation-delay: 0.2s; }
.status-card:nth-child(5) { animation-delay: 0.25s; }
.status-card:nth-child(6) { animation-delay: 0.3s; }
.status-card:nth-child(7) { animation-delay: 0.35s; }
.status-card:nth-child(8) { animation-delay: 0.4s; }

/* Media Queries */
@media (min-width: 600px) {
    .app-container {
        padding-top: 24px;
    }
    
    .status-card:hover {
        background: var(--card-bg-hover);
        transform: translateY(-2px);
    }
}
