/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.nav-link.logout {
    background-color: #e74c3c;
}

.nav-link.logout:hover {
    background-color: #c0392b;
}

.user-info {
    color: #ecf0f1;
    padding: 0.5rem 1rem;
}

/* Main Content */
.main {
    flex: 1;
    padding: 1rem 0;
}

/* Footer */
.footer {
    background-color: #34495e;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #2c3e50;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: #555;
}

.form-control {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* Demo Credentials */
.demo-credentials {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
}

.demo-credentials p {
    margin-bottom: 0.5rem;
    color: #555;
}

.demo-credentials ul {
    list-style: none;
    margin-top: 0.5rem;
}

.demo-credentials li {
    margin: 0.25rem 0;
}

.demo-credentials code {
    background-color: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: monospace;
}

/* Dashboard */
.dashboard,
.settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings {
    max-width: 800px;
    margin: 0 auto;
}

.page-title {
    font-size: 1.75rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* Dashboard Layout - Three Column */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Mobile: Single column */
.dashboard-sidebar,
.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-aside {
    display: none; /* Hidden on mobile */
}

/* Desktop: Three columns */
@media (min-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 280px 1fr 280px;
        gap: 1.5rem;
        align-items: start;
    }

    .dashboard-sidebar {
        position: sticky;
        top: 1rem;
    }

    .dashboard-main {
        max-width: 900px;
    }

    .dashboard-aside {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

/* Tablet: Two columns (hide right sidebar) */
@media (min-width: 768px) and (max-width: 991px) {
    .dashboard-layout {
        grid-template-columns: 260px 1fr;
        gap: 1.5rem;
        align-items: start;
    }

    .dashboard-sidebar {
        position: sticky;
        top: 1rem;
    }

    .dashboard-aside {
        display: none;
    }
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.card-header h2 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.card-subtitle {
    font-size: 0.875rem;
    color: #6c757d;
}

.card-body {
    padding: 1.5rem;
}

.card-compact .card-body {
    padding: 1rem;
}

/* Radio Status (merged user + device) */
.radio-status {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.radio-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    word-break: break-word;
}

.radio-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-detail-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.radio-detail-item .detail-value {
    word-break: break-word;
}

/* User Details */
.user-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.detail-label {
    font-weight: 600;
    color: #555;
}

.detail-value {
    color: #333;
}

/* Device Status */
.device-status {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.device-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

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

.status-badge.status-online {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.status-offline {
    background-color: #f8d7da;
    color: #721c24;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-online .status-dot {
    background-color: #28a745;
    animation: pulse 2s infinite;
}

.status-offline .status-dot {
    background-color: #dc3545;
}

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

.device-meta {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Events List */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-item {
    padding: 0.75rem;
    border-left: 4px solid #ccc;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.event-item.event-danger {
    border-left-color: #dc3545;
    background-color: #fff5f5;
}

.event-item.event-success {
    border-left-color: #28a745;
    background-color: #f0fff4;
}

.event-item.event-warning {
    border-left-color: #ffc107;
    background-color: #fffbf0;
}

.event-item.event-info {
    border-left-color: #17a2b8;
    background-color: #f0f9ff;
}

.event-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.event-type {
    font-weight: 600;
    color: #2c3e50;
}

.event-time {
    color: #6c757d;
    font-size: 0.875rem;
}

.event-message {
    color: #555;
}

/* Browsers List */
.browsers-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.browser-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.browser-item.current-browser {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.browser-info {
    flex: 1;
}

.browser-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
    padding-right: 4rem; /* Space for badge on mobile */
}

/* Current badge - mobile: top right, desktop: inline */
.current-badge {
    background-color: #2196f3;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

@media (min-width: 768px) {
    .browser-name {
        padding-right: 0;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }

    .current-badge {
        position: static;
        margin-left: 0.5rem;
    }
}

.browser-meta {
    color: #6c757d;
    font-size: 0.875rem;
}

.browser-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    display: block;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border-radius: 13px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

input[type="checkbox"]:checked + .toggle-label {
    background-color: #2196f3;
}

input[type="checkbox"]:checked + .toggle-label .toggle-slider {
    transform: translateX(24px);
}

/* Delete and Action Icons */
.delete-form-icon {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
}

.btn-delete-icon,
.btn-test-notification {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.3s;
    opacity: 0.6;
}

.btn-delete-icon:hover {
    opacity: 1;
    background-color: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

.btn-test-notification:hover {
    opacity: 1;
    background-color: rgba(33, 150, 243, 0.1);
    transform: scale(1.1);
}

.test-notification-form {
    display: inline-block;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* Permission Error */
.permission-error {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #fee;
    color: #c00;
    border: 1px solid #fcc;
    border-radius: 4px;
    font-size: 0.875rem;
    line-height: 1.4;
}

.pending-token {
    color: #6c757d;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .browser-item {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .browser-actions {
        width: 100%;
        justify-content: space-between;
    }

    .detail-row {
        flex-direction: column;
        gap: 0.25rem;
    }
}
