:root {
    --bg-color: #0d0e15;
    --card-bg: rgba(22, 24, 38, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: rgba(255, 255, 255, 0.08);
    --secondary-hover: rgba(255, 255, 255, 0.15);
    --success: #10b981;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* Background Glowing Blobs */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: var(--primary);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 45vw;
    height: 45vw;
    background: #a855f7;
}

/* Containers */
.container {
    width: 100%;
    max-width: 440px;
    padding: 40px 30px;
    position: relative;
}

#dashboard-screen.container {
    max-width: 800px;
    padding: 30px 20px;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

/* Typography & Titles */
.logo-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    letter-spacing: -1px;
    margin-bottom: 8px;
    color: #fff;
}

.logo-title span, .logo-title-sm span {
    color: var(--primary);
}

.logo-title-sm {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 35px;
}

.user-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-wrap {
    position: relative;
    width: 100%;
}

.input-wrap input {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.input-wrap input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.input-wrap label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 15px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.input-wrap input:focus ~ label,
.input-wrap input:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 12px;
    background: #141624;
    padding: 0 6px;
    color: var(--primary);
    transform: translateY(-50%);
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #white;
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 30px;
}

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

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* Devices Grid & Cards */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    min-height: 200px;
}

.device-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

.device-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.device-info-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.device-name {
    font-size: 18px;
    font-weight: 600;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

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

.status-offline {
    color: var(--text-secondary);
}
.status-offline .status-dot {
    background: var(--text-secondary);
}

.device-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.device-details span {
    color: var(--text-primary);
    font-weight: 500;
}

.device-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
}

.device-actions .btn {
    flex: 1;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.modal-content {
    width: 100%;
    max-width: 460px;
    padding: 35px 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.pairing-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pair-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.pair-val {
    font-size: 14px;
    color: #fff;
}

.font-mono {
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.font-bold {
    font-weight: 700;
}

.select-all {
    user-select: all;
    -webkit-user-select: all;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.modal-actions .btn {
    flex: 1;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.hidden {
    display: none !important;
}

/* Loading Spinner */
.loading-spinner-wrapper {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 40px 0;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

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

/* App Management Modal Styles */
.apps-modal-content {
    max-width: 500px !important;
    width: 90% !important;
}

.apps-list-container::-webkit-scrollbar {
    width: 6px;
}
.apps-list-container::-webkit-scrollbar-track {
    background: transparent;
}
.apps-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.app-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.app-item-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.app-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    margin-right: 16px;
    text-align: left;
}

.app-display-name {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.app-package-id {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    word-break: break-all;
}

/* Switch Toggle Button */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.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);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

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

input:checked + .slider {
    background-color: var(--danger);
}

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