/* ============================================
   PRISM DESIGN SYSTEM - COMPONENTS
   ============================================
   Reusable UI components: buttons, cards,
   forms, modals, tables, and more
   ============================================ */

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background: rgba(98, 0, 234, 0.08);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    box-shadow: var(--shadow);
}

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

.btn-success:hover {
    background: #45a049;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-base);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.08);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.card-body {
    margin-bottom: var(--spacing-md);
}

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

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: var(--spacing-md);
}

.text-input,
.select-input,
.textarea-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition-base);
}

.text-input:focus,
.select-input:focus,
.textarea-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(98, 0, 234, 0.1);
}

.select-input {
    cursor: pointer;
}

.textarea-input {
    resize: vertical;
    min-height: 100px;
}

.input-error {
    border-color: var(--error-color);
}

.input-helper {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.input-error-message {
    font-size: 12px;
    color: var(--error-color);
    margin-top: var(--spacing-xs);
}

/* Checkbox and Radio */
.checkbox-wrapper,
.radio-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.checkbox-wrapper input,
.radio-wrapper input {
    cursor: pointer;
}

/* ============================================
   TABLES
   ============================================ */

.data-table {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--background);
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.data-table tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-mode .data-table tr:hover {
    background: rgba(255, 140, 0, 0.05);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(98, 0, 234, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning-color);
}

.badge-error {
    background: rgba(207, 102, 121, 0.1);
    color: var(--error-color);
}

.badge-info {
    background: rgba(3, 169, 244, 0.1);
    color: var(--info-color);
}

/* ============================================
   ALERTS / MESSAGES
   ============================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.alert-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.alert-error {
    background: rgba(207, 102, 121, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(207, 102, 121, 0.2);
}

.alert-warning {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(255, 152, 0, 0.2);
}

.alert-info {
    background: rgba(3, 169, 244, 0.1);
    color: var(--info-color);
    border: 1px solid rgba(3, 169, 244, 0.2);
}

/* ============================================
   MODAL
   ============================================ */

.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: 1000;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
}

.modal-body {
    padding: var(--spacing-lg);
}

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

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner-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: 9999;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    color: var(--text-secondary);
}

.empty-state .material-icons {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: var(--spacing-md);
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 0;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav {
    display: flex;
    gap: var(--spacing-sm);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary-color);
    text-decoration: none;
}

.nav-link.active {
    background: rgba(124, 58, 237, 0.12);
    color: var(--primary-color);
}

body.dark-mode .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary-color);
}

/* Fix date/time input calendar icon in dark mode */
/* Date/time inputs should not be full width */
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
    width: auto;
    max-width: 200px;
}

body.dark-mode input[type="date"],
body.dark-mode input[type="datetime-local"],
body.dark-mode input[type="time"] {
    color-scheme: dark;
}

