/* ========================================
   1Office Test Runner - Styles
   Matching 1Office Design System
   ======================================== */

:root {
    /* Color Palette - 1Office Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f4f8;
    --bg-input: #ffffff;

    --accent-primary: #2563eb;
    --accent-secondary: #1d4ed8;
    --accent-light: #dbeafe;

    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --error-light: #fee2e2;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1a1a2e;
    --bg-card-hover: #242444;
    --bg-input: #16213e;

    --accent-primary: #3b82f6;
    --accent-secondary: #2563eb;
    --accent-light: #1e3a5f;

    --success: #22c55e;
    --success-light: #14532d;
    --warning: #f59e0b;
    --warning-light: #78350f;
    --error: #ef4444;
    --error-light: #7f1d1d;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --border-hover: #475569;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    /* iOS Safari fix */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight on mobile */
    touch-action: manipulation;
    /* Improve touch responsiveness */
}

/* Container */
.app-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    /* iOS Safari fix */
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.logo-text {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-title {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    padding-left: var(--space-md);
    border-left: 1px solid var(--border-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Dark Mode Toggle Button */
.theme-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

/* Custom Tooltips */
[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: auto;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
    animation-delay: 0.3s;
}

[title]:hover::before {
    content: '';
    position: absolute;
    bottom: auto;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--text-primary);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.2s ease forwards;
    animation-delay: 0.3s;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Disable tooltips on mobile/touch devices */
@media (max-width: 768px),
(pointer: coarse) {

    [title]:hover::after,
    [title]:hover::before {
        display: none !important;
        content: none !important;
    }
}

/* Tooltip position adjustments - show below all elements */
.app-card[title]:hover::after,
.browser-option[title]:hover::after,
.run-button[title]:hover::after,
.theme-toggle[title]:hover::after,
.toggle-btn[title]:hover::after,
.icon-btn[title]:hover::after,
.switch[title]:hover::after {
    bottom: auto;
    top: calc(100% + 8px);
}

.app-card[title]:hover::before,
.browser-option[title]:hover::before,
.run-button[title]:hover::before,
.theme-toggle[title]:hover::before,
.toggle-btn[title]:hover::before,
.icon-btn[title]:hover::before,
.switch[title]:hover::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: var(--text-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: blink 2s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.status-indicator.connected .status-dot {
    background: #10b981;
    animation: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-indicator.error .status-dot {
    background: #ef4444;
    animation: none;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

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

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    padding: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Sections */
.config-section,
.status-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.status-section {
    border-left-color: #10b981;
}

.section-header {
    margin-bottom: var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.panel-actions {
    display: flex;
    gap: var(--space-sm);
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--bg-card-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

/* Config Groups */
.config-group {
    margin-bottom: var(--space-xl);
    overflow: visible;
    position: relative;
}

.config-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.optional {
    font-weight: 400;
    color: var(--text-muted);
}

/* Environment Toggle */
.toggle-group {
    display: flex;
    gap: var(--space-sm);
    background: var(--bg-secondary);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.toggle-btn {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 500;
}

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

.toggle-btn.active {
    background: var(--bg-primary);
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.toggle-btn.active[data-value="qa"] {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.toggle-btn.active[data-value="prod"] {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* App Grid */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-md);
    overflow: visible;
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    /* iOS minimum touch target */
    position: relative;
    overflow: visible;
}

.app-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.app-card.selected {
    border-color: var(--accent-primary);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.app-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.app-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.all-icon {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}


.workflow-icon,
.pace-icon,
.finance-icon,
.hrms-icon {
    background: transparent;
    font-size: 1.75rem;
}

.app-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.app-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Select Dropdown */
.select-wrapper {
    position: relative;
}

.custom-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9375rem;
    cursor: pointer;
    appearance: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232563eb' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 2.5rem;
}

.custom-select:hover {
    border-color: #93c5fd;
}

.custom-select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.custom-select option {
    padding: 12px;
    background: var(--bg-card);
}

.custom-select optgroup {
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 0;
}

.custom-select option:checked {
    background: linear-gradient(0deg, #dbeafe 0%, #dbeafe 100%);
}

/* Custom Dropdown Component */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.dropdown-selected:hover {
    border-color: #93c5fd;
}

.custom-dropdown.open .dropdown-selected {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-selected-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    width: 18px;
    height: 18px;
    color: #2563eb;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 2px solid #60a5fa;
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-group-label {
    padding: 10px 16px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.9375rem;
    color: var(--text-primary);
    border-left: 3px solid transparent;
}

.dropdown-item:hover {
    background: #f0f9ff;
    color: #1e293b;
}

.dropdown-item.selected {
    background: #dbeafe;
    border-left-color: #2563eb;
    color: #2563eb;
    font-weight: 500;
}

/* Dark mode dropdown fixes */
[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    border-color: #60a5fa;
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover {
    background: #1e3a5f;
    color: #f1f5f9;
}

[data-theme="dark"] .dropdown-item.selected {
    background: #1e3a5f;
    color: #60a5fa;
}

[data-theme="dark"] .dropdown-group-label {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.dropdown-check {
    width: 16px;
    height: 16px;
    color: #2563eb;
    opacity: 0;
    flex-shrink: 0;
}

.dropdown-item.selected .dropdown-check {
    opacity: 1;
}

.dropdown-item:not(.selected) .dropdown-check {
    visibility: hidden;
}

/* Disable tooltips inside dropdown */
.custom-dropdown[title]:hover::after,
.custom-dropdown[title]:hover::before,
.dropdown-menu[title]:hover::after,
.dropdown-menu[title]:hover::before,
.dropdown-item[title]:hover::after,
.dropdown-item[title]:hover::before,
.dropdown-selected[title]:hover::after,
.dropdown-selected[title]:hover::before {
    display: none !important;
}

.custom-dropdown.open[title]:hover::after,
.custom-dropdown.open[title]:hover::before {
    display: none !important;
}

/* Browser Options */
.browser-options {
    display: flex;
    gap: var(--space-md);
    overflow: visible;
}

.browser-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
}

.browser-option input {
    display: none;
}

.browser-option:hover {
    border-color: var(--border-hover);
    z-index: 100;
}

.browser-option.selected {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.browser-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.browser-option.selected .browser-icon {
    color: var(--accent-primary);
}

.browser-icon svg {
    width: 18px;
    height: 18px;
}

.browser-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.browser-option.selected .browser-name {
    color: var(--accent-primary);
}

/* Email Toggle */
.email-toggle-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.email-info .config-label {
    margin-bottom: 0;
}

.email-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Switch - More Round Design */
.switch {
    position: relative;
    width: 52px;
    height: 28px;
    display: inline-block;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-full);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

input:checked+.slider {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:checked+.slider:before {
    transform: translateX(24px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked+.slider:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Email Recipients */
.email-recipients {
    display: none !important;
    animation: slideDown 0.2s ease;
    margin-top: var(--space-md);
}

.email-recipients.visible {
    display: block !important;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.email-display {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.email-display:not(:first-child) {
    margin-top: var(--space-sm);
}

.email-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.email-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    word-break: break-all;
}

/* Run Button */
.run-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    margin-top: var(--space-lg);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 48px;
}

/* Stop Button */
.stop-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    width: 100%;
    padding: var(--space-lg) var(--space-xl);
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    margin-top: var(--space-md);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
}

.stop-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stop-button:active {
    transform: translateY(0);
}

.stop-icon svg {
    width: 18px;
    height: 18px;
}

.run-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.run-button:active {
    transform: translateY(0);
}

.run-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.run-button.running {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
}

.run-icon svg {
    width: 18px;
    height: 18px;
}

.run-button.running .run-icon {
    animation: spin 1s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

/* Status Cards */
.status-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-xl);
}

.status-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.status-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-badge {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.idle {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.status-badge.running {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fcd34d;
    animation: pulse-badge 2s ease-in-out infinite;
}

.status-badge.success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #6ee7b7;
}

.status-badge.failed {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.status-card-body {
    padding: var(--space-lg);
    display: grid;
    gap: var(--space-md);
}

.status-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Logs Container */
.logs-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.logs-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.logs-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logs-output {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.8125rem;
    line-height: 1.8;
    max-height: 500px;
}

.log-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: var(--text-muted);
    text-align: center;
    gap: var(--space-md);
}

.log-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.log-entry {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    word-break: break-word;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: var(--text-muted);
    margin-right: var(--space-sm);
}

.log-entry.error {
    color: var(--error);
}

.log-entry.success {
    color: var(--success);
}

.log-entry.info {
    color: var(--accent-primary);
}

/* Footer */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-lg) var(--space-xl);
    text-align: center;
    margin-top: auto;
}

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

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-xl);
}

.modal-body p {
    margin: 0 0 var(--space-md) 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-warning {
    color: var(--error) !important;
    font-weight: 600;
    font-size: 1.0625rem;
    margin-top: var(--space-lg) !important;
}

.modal-footer {
    padding: var(--space-xl);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

.modal-btn {
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.modal-btn-cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-btn-cancel:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.modal-btn-confirm {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    color: white;
}

.modal-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--error);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Responsive Adjustments - Mobile First */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .main-content {
        padding: var(--space-md);
        gap: var(--space-md);
    }

    .header {
        padding: var(--space-md);
        flex-direction: row;
        gap: var(--space-sm);
        align-items: center;
        justify-content: space-between;
    }

    .header-left {
        flex-direction: row;
        gap: var(--space-sm);
        align-items: center;
        flex: 1;
        min-width: 0;
    }

    .logo {
        gap: var(--space-xs);
        flex-shrink: 0;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    .header-title {
        font-size: 0.75rem;
        padding-left: var(--space-sm);
        border-left: 1px solid var(--border-color);
    }

    .header-right {
        flex-shrink: 0;
        gap: var(--space-sm);
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    .status-indicator {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .status-text {
        display: inline;
        font-size: 0.6875rem;
    }

    .status-indicator .status-dot {
        width: 10px;
        height: 10px;
    }

    .config-section,
    .status-section {
        padding: var(--space-md);
    }

    .section-header {
        margin-bottom: var(--space-md);
    }

    .section-header h2 {
        font-size: 1.125rem;
    }

    .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .app-card {
        padding: var(--space-md);
        gap: var(--space-sm);
    }

    .app-icon {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }

    .app-icon svg {
        width: 18px;
        height: 18px;
    }

    .app-name {
        font-size: 0.875rem;
    }

    .app-tests {
        font-size: 0.6875rem;
    }

    .browser-options {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .browser-option {
        padding: var(--space-sm);
        min-width: 80px;
    }

    .browser-icon {
        width: 20px;
        height: 20px;
    }

    .browser-icon svg {
        width: 16px;
        height: 16px;
    }

    .browser-name {
        font-size: 0.75rem;
    }

    .toggle-group {
        gap: var(--space-xs);
    }

    .toggle-btn {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.875rem;
    }

    .toggle-icon {
        font-size: 1rem;
    }

    .custom-select {
        font-size: 0.875rem;
        padding: var(--space-sm) var(--space-md);
    }

    .run-button {
        padding: var(--space-md) var(--space-lg);
        font-size: 0.9375rem;
    }

    .run-icon svg {
        width: 16px;
        height: 16px;
    }

    .status-card {
        margin-bottom: var(--space-md);
    }

    .status-card-body {
        padding: var(--space-md);
    }

    .logs-output {
        font-size: 0.75rem;
        padding: var(--space-sm);
        max-height: 300px;
    }

    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
        bottom: var(--space-md);
    }

    .toast {
        max-width: 100%;
        padding: var(--space-sm) var(--space-md);
    }

    .toast-icon {
        width: 20px;
        height: 20px;
    }

    .toast-message {
        font-size: 0.8125rem;
    }

    .email-toggle-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .switch {
        align-self: flex-end;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .main-content {
        padding: var(--space-sm);
        gap: var(--space-sm);
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .browser-options {
        flex-direction: column;
    }

    .browser-option {
        width: 100%;
    }

    .config-group {
        margin-bottom: var(--space-md);
    }

    .section-header {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .panel-actions {
        align-self: flex-end;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .custom-select {
        -webkit-appearance: none;
    }

    input[type="text"],
    input[type="email"] {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .custom-select {
        -webkit-appearance: none;
    }
}