/* ===== BR-75 Minimalist Design System ===== */
/* Apple-inspired block design with light/dark themes */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8ed;
    --bg-elevated: #ffffff;

    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;

    --border-color: #d2d2d7;
    --border-light: #e8e8ed;

    --accent-primary: #0071e3;
    --accent-hover: #0077ed;
    --accent-active: #006edb;

    --success: #30d158;
    --warning: #ff9f0a;
    --danger: #ff3b30;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-elevated: #1c1c1e;

    --text-primary: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #6e6e73;

    --border-color: #38383a;
    --border-light: #2c2c2e;

    --accent-primary: #0a84ff;
    --accent-hover: #409cff;
    --accent-active: #0077ed;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo svg {
    color: var(--accent-primary);
}

.nav-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab-btn svg {
    flex-shrink: 0;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
}

/* ===== Main Container ===== */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 96px 24px 48px;
    min-height: 100vh;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

/* ===== Typography ===== */
h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 16px;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

/* ===== Buttons ===== */
.btn {
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    background: var(--accent-active);
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    color-scheme: light dark;
    /* Ensures calendar/time icons are visible in dark mode */
}

/* Make date/time inputs fully clickable */
input[type="date"],
input[type="time"] {
    cursor: pointer;
}

/* Calendar and time picker icons */
/* Light theme: invert to make icons dark */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(1);
    /* Invert to make icons DARK in light theme */
    opacity: 0.6;
}

/* Dark theme: don't invert, keep icons light */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0);
    /* Don't invert - keep icons LIGHT in dark theme */
    opacity: 0.9;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ===== Radio & Checkbox ===== */
.radio-group {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: var(--transition);
}

.radio-group label:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.radio-group input[type="radio"] {
    width: auto;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ===== Data Display ===== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    text-align: left;
    padding: 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table tbody td {
    padding: 16px;
    font-size: 15px;
}

/* ===== Utilities ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.toolbar-actions {
    display: flex;
    gap: 12px;
}

/* Modal overlay for br-creator (legacy support) */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.open {
    display: flex;
}

.modal-window {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.selection-display {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    cursor: pointer;
    transition: var(--transition);
    min-height: 52px;
    display: flex;
    align-items: center;
}

.selection-display:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.selectable-item {
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.selectable-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.selectable-item.selected {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    margin-bottom: 8px;
}

.checkbox-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.checkbox-item input {
    margin-right: 12px;
    cursor: pointer;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
    }

    .nav-tabs {
        overflow-x: auto;
        justify-content: flex-start;
    }

    .tab-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .main-container {
        padding: 88px 16px 32px;
    }

    .page-card {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }
}

/* Ensure cursor pointer on clickable elements */
button,
.tab-btn,
.btn,
.modal-close,
.selectable-item,
.checkbox-item,
.selection-display {
    cursor: pointer;
}

/* ===== Data Table Styles ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table thead {
  background: var(--bg-secondary);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

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

/* Icon buttons for table actions */
.icon-btn {
  background: transparent;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  transform: scale(1.1);
}

.icon-btn.danger:hover {
  background: rgba(255, 59, 48, 0.1);
}
