/* TelaSync — Design System */

:root {
    --color-primary: #0B1F3A;
    --color-accent: #00B8D9;
    --color-bg: #F8FAFC;
    --color-surface: #ffffff;
    --color-border: #E2E8F0;
    --color-text: #1E293B;
    --color-text-muted: #64748B;
    --color-online: #22C55E;
    --color-offline: #94A3B8;
    --color-warning: #F97316;
    --color-danger: #EF4444;
    --color-success: #22C55E;
    --sidebar-width: 240px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

/* Layout */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
}

.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    margin-left: var(--sidebar-width);
}

/* Sidebar */

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand__logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
    background: #fff;
    border-radius: 14px;
    padding: 10px 14px;
    box-sizing: border-box;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.15s;
    font-size: 14px;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(0,184,217,0.15);
    color: var(--color-accent);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.user-name { font-weight: 600; color: #fff; font-size: 13px; }
.user-role { color: rgba(255,255,255,0.5); font-size: 12px; }

.btn-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    width: 100%;
    font-size: 13px;
    transition: all 0.15s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Page Header */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-header__left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.page-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.back-link {
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    width: fit-content;
}

.back-link:hover {
    color: var(--color-accent);
}

.content-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.content-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.content-order {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-primary);
    font-weight: 600;
}

.btn-primary:hover { background: #00a3c4; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover { background: var(--color-bg); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover { background: var(--color-bg); }

.btn-danger {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

.btn-danger:hover { background: var(--color-danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* Cards de dispositivo */

.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.device-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.device-card:hover { box-shadow: var(--shadow-md); }

.device-card.online { border-left: 3px solid var(--color-online); }
.device-card.offline { border-left: 3px solid var(--color-offline); }

.device-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
}

.device-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-primary);
}

.device-card-body {
    padding: 0 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.device-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.info-label { color: var(--color-text-muted); }
.info-value { font-weight: 500; }

.device-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--color-border);
}

/* Status badges */

.status-badge {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
}

.badge-online { background: #dcfce7; color: #15803d; }
.badge-offline { background: #f1f5f9; color: #64748b; }
.badge-syncing { background: #dbeafe; color: #1d4ed8; }
.badge-revoked { background: #fee2e2; color: #dc2626; }

/* Mídias grid */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.media-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.media-preview {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.video-preview { background: #1e1b4b; color: #818cf8; }
.image-preview { background: #f0fdf4; color: #16a34a; }

.media-card-body {
    padding: 12px 16px;
}

.media-name {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.media-meta {
    display: flex;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.media-card-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px 12px;
}

/* Alertas */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

/* Formulários */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.15s;
    background: var(--color-surface);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0,184,217,0.1);
}

/* Login */

.login-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--color-surface);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand__logo {
    width: 100%;
    max-width: 220px;
    height: auto;
    display: block;
    margin: 0 auto 12px;
}

.login-header p {
    color: var(--color-text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Modal */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: var(--color-surface);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-box h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--color-primary);
}

.modal-box p {
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.code-input {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    letter-spacing: 6px;
    text-align: center;
    text-transform: uppercase;
}

/* Empty state */

.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--color-text-muted);
}

.empty-state p { margin-bottom: 8px; }
.empty-state .btn { margin-top: 16px; }

/* Loading */

.loading {
    text-align: center;
    padding: 48px;
    color: var(--color-text-muted);
}

/* Wizard */

.send-wizard {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.wizard-steps {
    display: flex;
    align-items: center;
    padding: 24px 32px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 500;
}

.wizard-step.active { color: var(--color-primary); }

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.wizard-step.active .step-number {
    background: var(--color-accent);
    color: var(--color-primary);
}

.wizard-step-divider {
    flex: 1;
    height: 1px;
    background: var(--color-border);
    margin: 0 16px;
}

.wizard-content {
    padding: 32px;
}

.wizard-content h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--color-primary);
}

.wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

/* Selectable list */

.select-all-row {
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.selectable-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
}

.selectable-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    background: var(--color-surface);
}

.selectable-item:hover { border-color: var(--color-accent); }
.selectable-item.selected { border-color: var(--color-accent); background: rgba(0,184,217,0.05); }

.item-icon { font-size: 18px; }

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name { font-weight: 500; font-size: 14px; }
.item-meta { font-size: 12px; color: var(--color-text-muted); }

/* Summary */

.summary-box {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.summary-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.summary-item {
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

/* Text helpers */

.text-success { color: var(--color-online); }
.text-muted { color: var(--color-text-muted); }

/* Upload progress */

.upload-progress {
    background: #dbeafe;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #1d4ed8;
}
