/* Dashboard and shared UI components
 * This file contains standardized styles that should be used consistently across all pages
 * Avoid inline styles and custom overrides - use these classes instead
 */

/* Turbo Drive progress bar - hidden to prevent distracting animation */
.turbo-progress-bar {
    visibility: hidden;
}

/* Header */
.user-welcome-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@supports (corner-shape: squircle) {
    .user-welcome-header {
        border-radius: 29px;
        corner-shape: squircle;
    }
}

.welcome-content h1 {
    font-size: 28px;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.welcome-content p {
    opacity: 0.9;
    margin: 0;
}

.edit-profile-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    /* NO transition on base state */
}

.edit-profile-link:hover {
    color: white;
    transition: color 0.2s;
}

.edit-profile-link i {
    margin-right: 6px;
}

/* Content sections */
.content-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 16px;
}

@supports (corner-shape: squircle) {
    .content-section {
        border-radius: 29px;
        corner-shape: squircle;
    }
}

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

.section-title {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: var(--neutral-dark);
}

.section-subtitle {
    font-size: 16px;
    font-weight: 500;
    margin: 16px 0 8px 0;
    color: var(--neutral-dark);
}

/* Card variations */
.card-simple {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@supports (corner-shape: squircle) {
    .card-simple {
        border-radius: 29px;
        corner-shape: squircle;
    }
}

/* Download section styling */
.download-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.download-card {
    background: #f9fafb;
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

@supports (corner-shape: squircle) {
    .download-card {
        border-radius: 29px;
        corner-shape: squircle;
    }
}

.download-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 22px;
}

.download-card-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.download-card-info {
    font-size: 14px;
    color: var(--neutral-medium);
    margin-bottom: 8px;
}

/* Back links */
.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--neutral-medium);
    text-decoration: none;
    margin-bottom: 16px;
    font-size: 15px;
}

.back-link:hover {
    color: var(--neutral-dark);
}

.back-link i {
    margin-right: 6px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.data-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 500;
    color: var(--neutral-medium);
    font-size: 14px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table .actions {
    text-align: right;
    white-space: nowrap;
}

/* Consistent table styling for workspace tables */
.workspace-table {
    width: 100%;
    margin: 0;
    border: none;
}

.workspace-table thead th {
    background-color: #f8f9fa;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    text-align: left;
}

.workspace-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    font-size: 14px;
}

.workspace-table tbody tr:last-child td {
    border-bottom: none;
}

.workspace-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Remove Bootstrap table styling conflicts */
.workspace-table.table {
    margin-bottom: 0;
    border: none;
}

/* Device section */
.device-count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    font-size: 24px;
    font-weight: 500;
    margin-right: 15px;
}

.device-info {
    flex: 1;
}

.device-title {
    font-weight: 500;
    margin: 0 0 5px 0;
}

.device-status {
    font-size: 14px;
    color: var(--neutral-medium);
}

/* Forms - Standardized across all pages */
.form-row {
    margin-bottom: 16px;
}

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--neutral-dark);
    font-size: 14px;
}

.form-input,
.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    /* NO transition on base state - only on focus */
    background-color: white;
    color: var(--neutral-dark);
    font-family: inherit;
}

@supports (corner-shape: squircle) {
    .form-input,
    .form-control {
        border-radius: 18px;
        corner-shape: squircle;
    }
}

.form-input:focus,
.form-control:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 156, 255, 0.2);
}

.form-input.readonly,
.form-control:disabled {
    background-color: #f9fafb;
    cursor: not-allowed;
    color: var(--neutral-medium);
}

.form-error {
    margin-top: 4px;
    font-size: 13px;
    color: var(--danger);
}

/* Ensure select elements match input styling */
select.form-input,
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}

@supports (corner-shape: squircle) {
    .alert {
        border-radius: 18px;
        corner-shape: squircle;
    }
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

/* Badges and tags - Standardized */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
}

.badge-primary {
    background-color: var(--brand-primary);
    color: white;
}

.badge-secondary {
    background-color: var(--brand-secondary);
    color: white;
}

.badge-success {
    background-color: var(--success);
    color: white;
}

.badge-warning {
    background-color: var(--warning);
    color: white;
}

.badge-danger {
    background-color: var(--danger);
    color: white;
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.user-count {
    display: inline-block;
    background: rgba(74, 156, 255, 0.1);
    color: var(--brand-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 14px;
    margin-left: 10px;
}

/* Buttons - Standardized across all pages */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    padding: 8px 16px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 12px;
    text-decoration: none;
    border: 1px solid transparent;
    font-family: inherit;
    /* NO transition on base state - prevents morphing on load */
}

@supports (corner-shape: squircle) {
    .btn {
        border-radius: 22px;
        corner-shape: squircle;
    }
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 8px;
}

@supports (corner-shape: squircle) {
    .btn-sm {
        border-radius: 14px;
        corner-shape: squircle;
    }
}

.btn-lg {
    padding: 10px 20px;
    font-size: 16px;
}

.btn-brand-primary {
    background-color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    color: white;
}

.btn-brand-primary:hover {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    color: white;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-outline-primary {
    background-color: transparent;
    border: 1px solid var(--brand-primary);
    color: var(--brand-primary);
}

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

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid var(--neutral-medium);
    color: var(--neutral-medium);
}

.btn-outline-secondary:hover {
    background-color: var(--neutral-medium);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    border: 1px solid var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.btn-outline-danger {
    background-color: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

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

/* Button group spacing */
.btn-group {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.btn-group form {
    display: inline-flex;
    margin: 0;
}

/* Consistent spacing for button containers */
.button-container {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--brand-primary); }
.text-secondary { color: var(--brand-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--neutral-medium); }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.flex-column { flex-direction: column; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Grid utilities */
.grid {
    display: grid;
    gap: 16px;
}

.grid-cols-2 { grid-template-columns: 1fr 1fr; }

@media (max-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: #f9fafb;
    border-radius: 16px;
}

@supports (corner-shape: squircle) {
    .empty-state {
        border-radius: 29px;
        corner-shape: squircle;
    }
}

.empty-state-icon {
    font-size: 48px;
    color: #e5e7eb;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
    color: var(--neutral-medium);
    margin-bottom: 8px;
}

.empty-state-subtext {
    font-size: 14px;
    color: var(--neutral-medium);
    margin-bottom: 16px;
}

/* Specific page styles */
.subscription-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    background: #e0f2fe;
    color: #0369a1;
    margin-left: 10px;
}

.subscription-badge.site-license {
    background: #dcfce7;
    color: #15803d;
}