/* Prime Calculator Wrapper */
.prime-calculator-wrapper {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 0;
    margin-bottom: 2rem;
    overflow: hidden;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.mode-selector::-webkit-scrollbar {
    display: none;
}

.mode-btn {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    position: relative;
    overflow: hidden;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.mode-btn:hover::before {
    left: 100%;
}

.mode-btn:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.mode-btn.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-color: #007bff;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.3);
}

.mode-icon {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

.mode-label {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

@media (max-width: 767px) {
    .mode-selector {
        padding: 12px;
        gap: 6px;
    }

    .mode-btn {
        min-width: 100px;
        padding: 12px 8px;
        gap: 6px;
    }

    .mode-icon {
        font-size: 20px;
    }

    .mode-label {
        font-size: 12px;
    }
}

/* Mode Panels */
.mode-panels {
    position: relative;
    min-height: 400px;
}

.mode-panel {
    display: none;
    padding: 32px;
    animation: fadeIn 0.3s ease-in-out;
}

.mode-panel.active {
    display: block;
}

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

.panel-header {
    margin-bottom: 24px;
}

.panel-title {
    font-size: 24px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.panel-description {
    font-size: 15px;
    color: #6c757d;
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 767px) {
    .mode-panel {
        padding: 20px;
    }

    .panel-title {
        font-size: 20px;
    }

    .panel-description {
        font-size: 14px;
    }
}

/* Input Group */
.input-group {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.label-icon {
    font-size: 1rem;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.number-input {
    flex: 1;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #1f2937;
    
    min-width: 0;
}

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

.number-input::placeholder {
    color: #9ca3af;
}

@media (max-width: 767px) {
    .input-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .number-input {
        padding: 0.625rem;
        font-size: 0.875rem;
    }
}

/* Action Button */
.action-btn {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.action-btn.primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.25);
}

.action-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.35);
}

.action-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.action-btn.loading .btn-text {
    opacity: 0;
}

.action-btn.loading .btn-loader {
    display: block;
}

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

@media (max-width: 767px) {
    .action-btn {
        width: 100%;
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* Result Container */
.result-container {
    min-height: 60px;
    margin-top: 24px;
}

.result-card {
    padding: 24px;
    border-radius: 12px;
    border-left: 4px solid;
    background: #f8f9fa;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-card.prime {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #f8f9fa 100%);
}

.result-card.composite {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f8f9fa 100%);
}

.result-card.info {
    border-left-color: #007bff;
    background: linear-gradient(135deg, #cfe2ff 0%, #f8f9fa 100%);
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #212529;
}

.result-text {
    font-size: 15px;
    line-height: 1.6;
    color: #495057;
    margin: 8px 0;
}

.result-text strong {
    color: #212529;
    font-weight: 600;
}

.prime-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.prime-number {
    display: inline-block;
    padding: 6px 12px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #ffffff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
    transition: transform 0.2s ease;
}

.prime-number:hover {
    transform: scale(1.05);
}

.prime-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #dee2e6;
}

.stat-item {
    flex: 1;
    min-width: 120px;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
}

@media (max-width: 767px) {
    .result-card {
        padding: 16px;
    }

    .result-title {
        font-size: 18px;
    }

    .result-text {
        font-size: 14px;
    }

    .prime-list {
        max-height: 200px;
        gap: 6px;
    }

    .prime-number {
        padding: 5px 10px;
        font-size: 13px;
    }

    .prime-stats {
        flex-direction: column;
        gap: 12px;
    }
}

/* Educational Content */
.educational-content {
    margin-top: 3rem;
}

.content-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.content-title {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 16px 0;
}

.content-subtitle {
    font-size: 22px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 12px 0;
}

.content-text {
    font-size: 16px;
    line-height: 1.7;
    color: #495057;
    margin: 0;
}

.prime-sequence {
    font-size: 16px;
    line-height: 1.8;
    color: #495057;
    
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin: 0;
    word-break: break-word;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.info-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.info-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.info-title {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 12px 0;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-list li {
    font-size: 15px;
    line-height: 1.8;
    color: #495057;
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
}

.info-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #007bff;
    font-weight: bold;
    font-size: 18px;
}

.info-list li strong {
    color: #212529;
    font-weight: 600;
}

@media (max-width: 767px) {
    .content-card {
        padding: 20px;
    }

    .content-title {
        font-size: 24px;
    }

    .content-subtitle {
        font-size: 20px;
    }

    .content-text {
        font-size: 15px;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .info-card {
        padding: 20px;
    }

    .info-title {
        font-size: 18px;
    }
}

/* Error Message */
.error-message {
    padding: 16px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    font-size: 14px;
    margin-top: 16px;
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
    font-size: 16px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e9ecef;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}
