/* ══════════════════════════════════════════════════════════
   COMPONENT STYLES — Cards, Badges, Buttons, Tables, etc.
   ══════════════════════════════════════════════════════════ */

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background-color: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgb(129 129 129 / 40%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* ── Overview Cards ────────────────────────────────────── */
.overview-card {
    background-color: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.overview-card.success {
    border-color: rgba(16, 185, 129, 0.3);
}

.overview-card.warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.overview-card.danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.overview-card.info {
    border-color: rgba(14, 165, 233, 0.3);
}

.overview-card.primary {
    border-color: rgba(0, 130, 145, 0.3);
}

.overview-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--primary);
}



.overview-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.overview-label {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.overview-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.overview-change.positive {
    color: var(--success);
    background-color: rgba(34, 197, 94, 0.1);
}

.overview-change.negative {
    color: var(--destructive);
    background-color: rgba(239, 68, 68, 0.1);
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--destructive);
}

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

.badge-primary {
    background-color: rgba(20, 184, 166, 0.1);
    color: var(--primary);
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    white-space: nowrap;
    user-select: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.96);
}

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

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent);
    border-color: var(--primary);
    color: var(--primary);
}


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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--accent);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.813rem;
}

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

/* ── Tables ────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    padding: 1rem 0.75rem;
    background-color: rgba(var(--primary), 0.03);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr {
    transition: background-color 0.2s ease;
}

.table tr:hover {
    background-color: rgba(var(--primary), 0.02);
}

/* ── Forms / Inputs ────────────────────────────────────── */
.form-group {
    display: grid;
    gap: 0.5rem;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
}

.form-input,
.form-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background-color: var(--background);
    transition: all 0.2s ease;
    font-family: inherit;
    color: var(--foreground);
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select {
    color-scheme: dark;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

/* ── Password Field Toggle ────────────────────────── */
.password-field {
    position: relative;
    width: 100%;
}

.password-field .form-input {
    padding-right: 2.5rem !important;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary);
    background-color: var(--muted);
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    background-color: var(--background);
    color: var(--foreground);
}

.search-input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.filter-select {
    padding: 0.5rem 1.75rem 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background-color: var(--background);
    font-family: inherit;
    color: var(--foreground);
    width: 220px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-list {
    display: flex;
    gap: 1rem;
}

.tab-button {
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: var(--muted-foreground);
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.9rem;
}

.tab-button:hover {
    color: var(--foreground);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ── Alerts ────────────────────────────────────────────── */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-left: 4px solid;
    transition: opacity 0.3s ease;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-left-color: var(--info);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-left-color: var(--destructive);
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    border-left-color: var(--success);
}

/* ── Activity Feed ─────────────────────────────────────── */
.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* ── Machine Grid ──────────────────────────────────────── */
.machine-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.machine-slot {
    aspect-ratio: 1;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.7rem;
    padding: 0.25rem;
    text-align: center;
}

.machine-slot:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.machine-slot.filled {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}

.machine-slot.low-stock {
    background-color: var(--warning);
    color: white;
    border-color: var(--warning);
}

.machine-slot.empty {
    background-color: var(--muted);
    color: var(--muted-foreground);
}

.slot-id {
    font-weight: 600;
    font-size: 0.75rem;
}

.slot-product {
    font-size: 0.6rem;
    margin-top: 0.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.slot-stock {
    font-weight: 700;
    font-size: 0.7rem;
}

.slot-price {
    font-size: 0.6rem;
    opacity: 0.85;
}

/* ── Modals ────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    background-color: var(--muted);
    color: var(--foreground);
}

.modal-body {
    display: grid;
    gap: 1rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ── Toast Notifications ───────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

/* ── Universal Components ──────────────────────────────── */
.theme-toggle-floating {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--foreground);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle-floating:hover {
    background-color: var(--accent);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--popover);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 450px;
    pointer-events: all;
    animation: toastSlideIn 0.3s ease;
    transition: all 0.3s ease;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    font-size: 1.125rem;
    padding: 0;
    flex-shrink: 0;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--destructive);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--info);
}

/* ── Loading Skeleton ──────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--muted) 25%, var(--border) 50%, var(--muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 2rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 120px;
}

.skeleton-row {
    height: 3rem;
    margin-bottom: 0.5rem;
}

/* ── Empty State ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--muted-foreground);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

/* ── Chart Bars (simple CSS chart) ─────────────────────── */
.chart-bar-container {
    display: flex;
    align-items: end;
    justify-content: space-around;
    height: 250px;
    padding: 20px;
}

.chart-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.chart-bar {
    width: 40px;
    background: linear-gradient(180deg, var(--primary), var(--primary-hover));
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: height 0.5s ease;
    min-height: 4px;
}

.chart-bar-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

.chart-bar-value {
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Utility: Segmented Control (Toggle Group) ─────────── */
.segmented-control {
    display: flex;
    background: var(--secondary);
    padding: 4px;
    border-radius: var(--radius-lg);
    gap: 4px;
    border: 1px solid var(--border);
}

.segmented-option {
    flex: 1;
    text-align: center;
}

.segmented-option input {
    display: none;
}

.segmented-option span {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.813rem;
    font-weight: 700;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.segmented-option span:hover {
    color: var(--foreground);
    background-color: rgba(0, 0, 0, 0.03);
}

.segmented-option input:checked+span {
    background-color: var(--primary);
    color: var(--primary-foreground);
    box-shadow: var(--shadow-sm);
}

/* ── Utility: Toolbar ─────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.toolbar-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

/* ── Utility: Divider with Text ───────────────────────── */
.divider-with-text {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--muted-foreground);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    gap: 1rem;
}

.divider-with-text::before,
.divider-with-text::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

/* ── Scrollbar Enhancements ─────────── */
.table-scroll {
    max-height: 500px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}