* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
    min-height: 100vh;
    color: #1f2937;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-button {
    background: none;
    border: none;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: color 0.2s ease;
}

.nav-button:hover {
    color: #2563eb;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 6rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.card-content {
    padding: 1.5rem;
}

.text-center {
    text-align: center;
}

/* Typography */
.title {
    font-size: 1.875rem;
    font-weight: bold;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #6b7280;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e40af;
}

/* Badges */
.badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid;
}

.badge-blue {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.badge-green {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #86efac;
}

.badge-purple {
    background-color: #faf5ff;
    color: #7c3aed;
    border-color: #c4b5fd;
}

.badge-yellow {
    background-color: #fefce8;
    color: #a16207;
    border-color: #fde047;
}

/* Step Control */
.step-control {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 50;
    background: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    border: 2px solid #93c5fd;
    border-radius: 0.75rem;
    padding: 1rem;
}

.step-control-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-control-title {
    font-weight: 600;
    color: #1e40af;
}

.step-info {
    font-size: 0.875rem;
    color: #6b7280;
}

.step-help {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Array Grid */
.array-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .array-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

.array-cell {
    height: 4rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 0.75rem;
    background: #f9fafb;
    transition: all 0.3s ease;
}

.array-cell.current {
    background: #fef3c7;
    border-color: #f59e0b;
    transform: scale(1.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.array-cell.found {
    background: #dcfce7;
    border-color: #16a34a;
}

.array-cell.not-found {
    background: #fecaca;
    border-color: #dc2626;
}

.array-index {
    color: #6b7280;
    font-size: 0.625rem;
}

.array-value {
    text-align: center;
    word-break: break-word;
    overflow: hidden;
}

/* Execution Status */
.execution-status {
    text-align: center;
    padding: 0.75rem;
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 0.5rem;
    animation: pulse 1.5s infinite;
}

.execution-step {
    font-size: 0.875rem;
    font-weight: 600;
    color: #a16207;
}

/* Setup Options */
.setup-options h4 {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 1rem;
}

.options-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.option-card {
    border: 2px solid;
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.option-card:hover {
    transform: scale(1.02);
}

.option-random {
    border-color: #93c5fd;
    background: #eff6ff;
}

.option-manual {
    border-color: #86efac;
    background: #f0fdf4;
}

.option-card h3 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.option-card p {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

/* Progress */
.progress-section {
    margin-bottom: 1rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #10b981;
    transition: width 0.3s ease;
}

/* Input Section */
.input-section {
    display: flex;
    gap: 0.5rem;
}

.input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Search Section */
.search-section {
    background: #fff7ed;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.search-section h4 {
    font-weight: 600;
    color: #ea580c;
    margin-bottom: 0.5rem;
}

/* Suggestions */
.suggestions h5 {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.suggestion-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .suggestion-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Variables Grid */
.variables-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .variables-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.variable-card {
    border: 2px solid;
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
}

.variable-name {
    font-family: monospace;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.variable-value {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.variable-desc {
    font-size: 0.75rem;
}

.variable-x {
    background: #faf5ff;
    border-color: #c4b5fd;
    color: #7c3aed;
}

.variable-f {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #dc2626;
}

.variable-f.found {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.variable-i {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

.variable-thesi {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #6b7280;
}

.variable-thesi.active {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.variable-n {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #6b7280;
}

.variables-info {
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* Code Display */
.code-display {
    background: #1f2937;
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.code-line {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    position: relative;
}

.code-line:hover {
    background: #374151;
}

.code-line.active {
    background: #ca8a04;
    color: black;
    font-weight: bold;
    transform: scale(1.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #fbbf24;
}

.line-number {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

.line-description {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.code-badges {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

/* Instructions */
.instructions {
    background: #eef2ff;
    padding: 1rem;
    border-radius: 0.5rem;
}

.instructions h4 {
    font-weight: 600;
    color: #3730a3;
    margin-bottom: 0.5rem;
}

.instructions ul {
    font-size: 0.875rem;
    color: #4338ca;
    list-style-type: disc;
    margin-left: 1.25rem;
}

.instructions li {
    margin-bottom: 0.25rem;
}

/* Results */
.results-content {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.results-content.success {
    background: #f0fdf4;
}

.results-content.error {
    background: #fef2f2;
}

.results-content div {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.performance-analysis {
    background: #eff6ff;
    padding: 1rem;
    border-radius: 0.5rem;
}

.performance-analysis h4 {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.performance-analysis ul {
    font-size: 0.875rem;
    list-style-type: disc;
    margin-left: 1.25rem;
}

.performance-analysis li {
    margin-bottom: 0.25rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-blue {
    background: #2563eb;
    color: white;
}

.btn-blue:hover {
    background: #1d4ed8;
}

.btn-green {
    background: #16a34a;
    color: white;
}

.btn-green:hover {
    background: #15803d;
}

.btn-orange {
    background: #ea580c;
    color: white;
}

.btn-orange:hover {
    background: #dc2626;
}

.btn-gray {
    background: #6b7280;
    color: white;
}

.btn-gray:hover {
    background: #4b5563;
}

.btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}

.btn-outline:hover {
    background: #f9fafb;
}

/* Reset Section */
.reset-section {
    text-align: center;
}

/* Utility Classes */
.hidden {
    display: none;
}

.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

.scale {
    animation: scale 0.5s ease;
}

@keyframes scale {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
    }
    
    .step-control {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 1rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .badges {
        flex-direction: column;
        align-items: center;
    }
}