/* Cocopi Frontend Library Styles */

.cocopi-frontend-library {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Hero Section */
.cocopi-hero-section {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.cocopi-hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.cocopi-hero-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

.cocopi-hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.cocopi-hero-description {
    font-size: 1.2rem;
    margin: 0 0 40px 0;
    opacity: 0.9;
    max-width: 600px;
}

.cocopi-hero-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.cocopi-btn {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
}

.cocopi-btn-primary {
    background: #ff6b35;
    color: white;
}

.cocopi-btn-primary:hover {
    background: #e55a2b;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.cocopi-btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.cocopi-btn-secondary:hover {
    background: white;
    color: #1e3c72;
}

/* Filters Section */
.cocopi-filters-section {
    background: #f8f9fa;
    padding: 40px 0;
    border-bottom: 1px solid #e9ecef;
}

.cocopi-filters-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.cocopi-filter-row {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.cocopi-filter-group {
    flex: 1;
    min-width: 250px;
}

.cocopi-filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #495057;
}

.cocopi-radio-group,
.cocopi-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.cocopi-radio-group label,
.cocopi-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.cocopi-filter-group select,
.cocopi-filter-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.cocopi-filter-group select:focus,
.cocopi-filter-group input[type="text"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.cocopi-btn-search {
    background: #007bff;
    color: white;
    padding: 12px 30px;
}

.cocopi-btn-search:hover {
    background: #0056b3;
}

.cocopi-btn-reset {
    background: #6c757d;
    color: white;
    padding: 12px 30px;
}

.cocopi-btn-reset:hover {
    background: #545b62;
}

/* Patterns Section */
.cocopi-patterns-section {
    padding: 60px 0;
    max-width: 1200px;
    margin: 0 auto;
}

.cocopi-patterns-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 20px;
}

.cocopi-patterns-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #1e3c72;
}

.cocopi-patterns-count {
    font-size: 1.1rem;
    color: #6c757d;
}

.cocopi-patterns-count span {
    font-weight: 700;
    color: #007bff;
}

.cocopi-loading {
    text-align: center;
    padding: 60px 20px;
}

.cocopi-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cocopi-patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    padding: 0 20px;
}

.cocopi-pattern-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.cocopi-pattern-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.cocopi-pattern-preview {
    background: #f8f9fa;
    padding: 30px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e9ecef;
}

.cocopi-pattern-preview-content {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.cocopi-pattern-info {
    padding: 25px;
}

.cocopi-pattern-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: #1e3c72;
    line-height: 1.3;
}

.cocopi-pattern-description {
    color: #6c757d;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.cocopi-pattern-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.cocopi-meta-tag {
    background: #e9ecef;
    color: #495057;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.cocopi-pattern-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cocopi-btn-view {
    background: #6c757d;
    color: white;
    flex: 1;
    min-width: 120px;
}

.cocopi-btn-view:hover {
    background: #545b62;
}

.cocopi-btn-copy {
    background: #ffc107;
    color: #212529;
    flex: 1;
    min-width: 120px;
}

.cocopi-btn-copy:hover {
    background: #e0a800;
}

.cocopi-btn-favorite {
    background: #dc3545;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.cocopi-btn-favorite:hover {
    background: #c82333;
}

.cocopi-heart-icon {
    margin-right: 8px;
}

/* Pagination */
.cocopi-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding: 0 20px;
}

.cocopi-pagination button {
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    background: white;
    color: #007bff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cocopi-pagination button:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.cocopi-pagination button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.cocopi-pagination button:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* How-to Section */
.cocopi-howto-section {
    background: #f8f9fa;
    padding: 80px 0;
    margin-top: 60px;
}

.cocopi-howto-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.cocopi-howto-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 50px 0;
    color: #1e3c72;
}

.cocopi-howto-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.cocopi-step {
    background: white;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.cocopi-step-number {
    width: 60px;
    height: 60px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 20px;
}

.cocopi-step h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: #1e3c72;
}

.cocopi-step p {
    color: #6c757d;
    line-height: 1.6;
    margin: 0;
}

/* Modal */
.cocopi-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.cocopi-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cocopi-modal-close {
    position: absolute;
    right: 25px;
    top: 25px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cocopi-modal-close:hover {
    color: #000;
    background: #f8f9fa;
}

.cocopi-modal-header {
    background: #f8f9fa;
    padding: 40px;
    border-bottom: 1px solid #e9ecef;
}

.cocopi-modal-header h2 {
    margin: 0 0 15px 0;
    color: #1e3c72;
    font-size: 2rem;
}

.cocopi-modal-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.cocopi-modal-meta span {
    background: #e9ecef;
    color: #495057;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.cocopi-modal-body {
    padding: 40px;
}

.cocopi-pattern-preview h3,
.cocopi-pattern-code h3 {
    margin: 0 0 20px 0;
    color: #1e3c72;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 15px;
    font-size: 1.3rem;
}

.cocopi-pattern-preview {
    margin-bottom: 40px;
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    min-height: 250px;
}

.cocopi-code-container {
    position: relative;
    margin-bottom: 30px;
}

.cocopi-code-container textarea {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
    background: #f8f9fa;
}

.cocopi-btn-copy {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #28a745;
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.cocopi-btn-copy:hover {
    background: #218838;
}

.cocopi-pattern-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.cocopi-btn-share {
    background: #17a2b8;
    color: white;
    flex: 1;
}

.cocopi-btn-share:hover {
    background: #138496;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cocopi-hero-title {
        font-size: 2rem;
    }
    
    .cocopi-hero-description {
        font-size: 1rem;
    }
    
    .cocopi-hero-buttons {
        flex-direction: column;
    }
    
    .cocopi-filter-row {
        flex-direction: column;
    }
    
    .cocopi-filter-group {
        min-width: auto;
    }
    
    .cocopi-patterns-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }
    
    .cocopi-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .cocopi-modal-header,
    .cocopi-modal-body {
        padding: 25px;
    }
    
    .cocopi-howto-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .cocopi-hero-section {
        padding: 60px 0;
    }
    
    .cocopi-hero-title {
        font-size: 1.8rem;
    }
    
    .cocopi-patterns-header h2 {
        font-size: 2rem;
    }
    
    .cocopi-pattern-card {
        margin: 0 10px;
    }
}

/* Premium Badge */
.cocopi-premium-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #ffc107;
    color: #212529;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 1;
}

/* Loading States */
.cocopi-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Success/Error Messages */
.cocopi-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.cocopi-message.success {
    background: #28a745;
}

.cocopi-message.error {
    background: #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
