/* ===================================
   DuraEdge - Components
   Reusable UI Components
   =================================== */

/* ===================================
   Cards
   =================================== */

.card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-gradient {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

/* ===================================
   Badges
   =================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ===================================
   Alerts
   =================================== */

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 1rem;
}

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

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--secondary);
    color: #065f46;
}

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

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: #991b1b;
}

/* ===================================
   Forms
   =================================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: var(--transition-base);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-help {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.form-error {
    font-size: 0.85rem;
    color: var(--danger);
    margin-top: 0.5rem;
}

/* ===================================
   Tooltips
   =================================== */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: white;
    font-size: 0.85rem;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-base);
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-base);
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* ===================================
   Progress Bars
   =================================== */

.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.progress-bar-animated {
    background: linear-gradient(
        90deg,
        var(--primary) 0%,
        var(--primary-light) 50%,
        var(--primary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}

/* ===================================
   Dividers
   =================================== */

.divider {
    height: 1px;
    background: var(--border);
    margin: 2rem 0;
}

.divider-gradient {
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0.3;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

/* ===================================
   Code Blocks
   =================================== */

code {
    padding: 0.2rem 0.4rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary);
}

pre {
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    padding: 0;
    background: none;
    border: none;
    color: var(--text-primary);
}

/* ===================================
   Modals
   =================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-base);
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: var(--transition-base);
}

.modal.active .modal-content {
    transform: scale(1);
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: var(--transition-base);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ===================================
   Accordions
   =================================== */

.accordion {
    border-radius: 8px;
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--border);
}

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

.accordion-header {
    padding: 1.25rem 1.5rem;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-base);
}

.accordion-header:hover {
    background: var(--bg-secondary);
}

.accordion-title {
    font-weight: 600;
    margin: 0;
}

.accordion-icon {
    transition: transform var(--transition-base);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.accordion-item.active .accordion-content {
    max-height: 1000px;
}

.accordion-body {
    padding: 0 1.5rem 1.5rem;
}

/* ===================================
   Tables
   =================================== */

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

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

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

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

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

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

/* ===================================
   Loading States
   =================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
}

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

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

/* ===================================
   Empty States
   =================================== */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ===================================
   Utility Components
   =================================== */

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.shadow-soft {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shadow-medium {
    box-shadow: var(--shadow-md);
}

.shadow-strong {
    box-shadow: var(--shadow-xl);
}

.rounded {
    border-radius: 8px;
}

.rounded-lg {
    border-radius: 16px;
}

.rounded-full {
    border-radius: 9999px;
}
