/* iFixit Repair Guides Styling */

/* Guide Grid Layout */
.guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* Guide Cards */
.guide-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e5e7eb;
}

.guide-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.guide-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.guide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.guide-card:hover .guide-image img {
    transform: scale(1.05);
}

.difficulty-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.difficulty-easy { background: #10b981; }
.difficulty-moderate { background: #f59e0b; }
.difficulty-difficult { background: #ef4444; }
.difficulty-unknown { background: #6b7280; }

/* Guide Content */
.guide-content {
    padding: 1.5rem;
}

.guide-header {
    margin-bottom: 1rem;
}

.guide-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

.guide-link {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.guide-link:hover {
    color: #007AFF;
}

.guide-category {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.guide-summary {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3; /* Standard property for supporting browsers */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Guide Meta */
.guide-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.meta-icon {
    font-size: 1rem;
}

/* Guide Actions */
.guide-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.guide-actions .btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #007AFF;
    color: white;
}

.btn-primary:hover {
    background: #0056CC;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    margin: 2rem auto;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 0 2rem 2rem;
}

/* Guide Intro */
.guide-intro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.guide-hero-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
}

.info-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
}

/* Guide Sections */
.guide-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
}

.guide-section h3 {
    margin: 0 0 1rem 0;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Tools and Parts */
.tools-grid,
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.tool-item,
.part-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.tool-image,
.part-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.tool-name,
.part-name {
    flex: 1;
    font-weight: 500;
}

.required-badge {
    background: #ef4444;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.optional-badge {
    background: #6b7280;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.part-link {
    color: #007AFF;
    text-decoration: none;
    font-size: 0.875rem;
}

.part-link:hover {
    text-decoration: underline;
}

/* Steps */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.step-item {
    display: flex;
    gap: 1rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.step-number {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    background: #007AFF;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.step-content h4 {
    margin: 0 0 0.5rem 0;
    color: #1f2937;
    font-size: 1.1rem;
}

.step-text {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.step-media {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.step-image {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

/* Guide Footer */
.guide-footer {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    text-align: center;
}

.source-attribution {
    margin-bottom: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.source-attribution a {
    color: #007AFF;
    text-decoration: none;
    font-weight: 500;
}

.source-attribution a:hover {
    text-decoration: underline;
}

/* Loading Modal */
.loading-content {
    position: relative;
    background: white;
    margin: 20vh auto;
    width: 300px;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #007AFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    color: #374151;
    font-size: 1.25rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Filter Controls */
.guide-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .guides-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .guide-intro {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body {
        padding: 1rem;
    }
    
    .step-item {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        align-self: center;
    }
    
    .tools-grid,
    .parts-grid {
        grid-template-columns: 1fr;
    }
    
    .guide-actions {
        flex-direction: column;
    }
    
    .guide-actions .btn {
        flex: none;
    }
}

@media (max-width: 480px) {
    .guide-filters {
        flex-direction: column;
    }
    
    .step-image {
        width: 100px;
        height: 60px;
    }
}