/* iSpark Custom Styles */

:root {
    --primary: #d5271a;
    --primary-dark: #b01f13;
    --primary-light: #e84a3e;
    --accent: #7a7e81;
    --accent-light: #9ba0a3;
    /* Microsoft Fabric colors */
    --fabric: #1F6B4A;
    --fabric-dark: #155838;
    --fabric-light: #E8F5EE;
}

/* Button Styles */
.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(213, 39, 26, 0.3);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background-color: var(--accent);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background-color: #5a5e61;
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

/* Progress Steps */
.progress-steps {
    --step-width: 6rem;
    /* 96px - Fixed width for consistent alignment */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    padding-top: 12px;
    /* Added spacing */
}

/* Background line */
.progress-steps::before {
    content: '';
    position: absolute;
    top: 21px;
    /* 9px + 12px padding */
    left: calc(var(--step-width) / 2);
    right: calc(var(--step-width) / 2);
    height: 2px;
    background-color: #d1d5db;
    z-index: 1;
}

/* Progress fill line */
.progress-steps::after {
    content: '';
    position: absolute;
    top: 21px;
    /* 9px + 12px padding */
    left: calc(var(--step-width) / 2);
    /* Width is fraction of total line length (100% - step width) */
    width: calc(var(--progress-fraction, 0) * (100% - var(--step-width)));
    height: 2px;
    background-color: var(--primary);
    z-index: 2;
    transition: width 0.3s ease;
}

/* Individual step container */
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 3;
    width: var(--step-width);
    /* Fixed width forces center to be at 3rem */
}

/* Default dot (future steps) */
.progress-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #9ca3af;
    /* Gray 400 */
    margin-top: 6px;
    /* Center vertically: (20px - 8px) / 2 = 6px */
    margin-bottom: 6px;
    /* Align text with larger dots */
    transition: all 0.3s ease;
}

/* Active step - large dot with inner circle */
.progress-step.active .progress-step-dot {
    width: 20px;
    height: 20px;
    margin-top: 0;
    margin-bottom: 0;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-step.active .progress-step-dot::after {
    content: '';
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
}

/* Completed step - large dot with checkmark */
.progress-step.completed .progress-step-dot {
    width: 20px;
    height: 20px;
    margin-top: 0;
    margin-bottom: 0;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-step.completed .progress-step-dot::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

/* Step label */
.progress-step-label {
    margin-top: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    /* Gray 400 */
    white-space: nowrap;
}

.progress-step.active .progress-step-label,
.progress-step.completed .progress-step-label {
    color: var(--primary);
}



/* Step Content */
.step-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* File Card Styles */
.file-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.3s ease;
}

.file-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.file-icon {
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--primary);
    color: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.file-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Table Preview Styles */
.table-preview {
    overflow-x: auto;
    margin-top: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.table-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-preview th {
    background-color: #f9fafb;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.table-preview td {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    color: #6b7280;
}

/* Configuration Card */
.config-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
}

.config-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-card-body {
    padding: 1.5rem;
}

.config-section {
    margin-bottom: 1.5rem;
}

.config-section-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* Form Input Styles */
.form-input {
    width: 100%;
    padding: 0.625rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(213, 39, 26, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.625rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(213, 39, 26, 0.1);
}

/* Column Row */
.column-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    margin-bottom: 0.5rem;
}

.column-row:hover {
    background-color: #f3f4f6;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-fact {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-dimension {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-ai {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

/* Relationship Card */
.relationship-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.relationship-card:hover {
    border-color: var(--primary);
    background-color: #fff;
}

.relationship-arrow {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 1rem;
}

/* Measure Card */
.measure-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.2s ease;
}

.measure-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.measure-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.measure-dax {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    border: 1px solid #e5e7eb;
}

/* Summary Stats */
.summary-stat {
    text-align: center;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
}

.summary-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Loading Spinner */
.spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-small {
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-overlay-content {
    text-align: center;
    background-color: white;
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.spinner-large {
    width: 4rem;
    height: 4rem;
    border: 5px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

.loading-overlay-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.loading-overlay-subtext {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Drag and Drop Hover Effect */
#dropzone.drag-over {
    border-color: var(--primary);
    background-color: rgba(213, 39, 26, 0.05);
}

/* Question Box */
.question-box {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.question-box-title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.question-box-title svg {
    margin-right: 0.5rem;
}

/* Collapsible Section */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.expanded {
    max-height: 2000px;
}

/* Utility Classes */
.text-primary {
    color: var(--primary);
}

.text-accent {
    color: var(--accent);
}

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

.border-primary {
    border-color: var(--primary);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .column-row {
        grid-template-columns: 1fr;
    }

    .relationship-card {
        flex-direction: column;
        text-align: center;
    }

    .relationship-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
}

/* Microsoft Fabric Styles */
.text-fabric {
    color: var(--fabric);
}

.bg-fabric {
    background-color: var(--fabric);
}

.bg-fabric:hover {
    background-color: var(--fabric-dark);
}

.bg-fabric-light {
    background-color: var(--fabric-light);
}

.border-fabric {
    border-color: var(--fabric);
}

.focus-ring-fabric:focus {
    outline: none;
    border-color: var(--fabric);
    box-shadow: 0 0 0 3px rgba(31, 107, 74, 0.2);
}

.hover-bg-fabric-dark:hover {
    background-color: var(--fabric-dark);
}

/* =============================
   Report Wireframe Grid Styles
   ============================= */

.view-container,
.wireframe-view {
    width: 100%;
    min-width: 0;
}

.wireframe-canvas {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    display: grid;
    min-width: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    box-sizing: border-box;
}

.wireframe-cell {
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    transition: box-shadow 0.15s;
    position: relative;
}

.wireframe-cell-slicer {
    background: #f0f7ff;
    border: 1.5px solid #93c5fd;
}

.wireframe-cell-kpi {
    background: #f5f0ff;
    border: 1.5px solid #c4b5fd;
}

.wireframe-cell-chart {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
}

.wireframe-cell-empty {
    background: #fafafa;
    border: 1.5px dashed #d1d5db;
}

.wireframe-cell:not(.wireframe-cell-empty):hover {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
    z-index: 1;
}

.wireframe-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    padding: 8px 6px;
    text-align: center;
    overflow: hidden;
    min-width: 0;
}

.wireframe-cell-sketch {
    flex-shrink: 0;
}

.wireframe-sketch {
    width: 56px;
    height: 28px;
}

.wireframe-cell-slicer .wireframe-sketch {
    width: 44px;
    height: 18px;
}

.wireframe-cell-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #374151;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
}

.wireframe-cell-badge {
    font-size: 0.6rem;
    color: #6b7280;
    opacity: 0.8;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
}

/* Slicer row: horizontal layout, compact */
.wireframe-cell-slicer .wireframe-cell-inner {
    flex-direction: row;
    gap: 6px;
    padding: 4px 8px;
}

.wireframe-cell-slicer .wireframe-cell-title {
    font-size: 0.65rem;
}

.wireframe-cell-slicer .wireframe-cell-badge {
    display: none;
}

/* Chart cells get larger sketches */
.wireframe-cell-chart .wireframe-sketch {
    width: 64px;
    height: 32px;
}

.wireframe-cell-chart .wireframe-cell-title {
    font-size: 0.75rem;
}

.wireframe-cell-chart .wireframe-cell-badge {
    font-size: 0.6rem;
}
