/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e74c3c;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: color 0.3s;
}

.nav a:hover, .nav a.active {
    color: #e74c3c;
}

/* Hero section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-cta {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

/* Search form */
.search-form {
    background: white;
    padding: 2rem;
    margin: -50px auto 3rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allows flex items to shrink below content size */
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-control {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Results header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 1.1rem;
    color: #666;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

/* Course grid */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.course-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.course-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.course-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.course-title a {
    color: #333;
    text-decoration: none;
}

.course-title a:hover {
    color: #667eea;
}

.course-provider {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.course-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stars {
    color: #ffc107;
}

.star {
    font-size: 1rem;
}

.star.filled {
    color: #ffc107;
}

.star.empty {
    color: #e0e0e0;
}

.rating-text {
    font-size: 0.9rem;
    color: #666;
}

.course-content {
    padding: 1.5rem;
}

.course-description {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.course-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.meta-value {
    font-weight: 600;
    color: #333;
}

.price {
    color: #e74c3c;
    font-size: 1.2rem;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.course-actions {
    display: flex;
    gap: 1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Course detail page */
.course-detail {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.course-detail-header {
    padding: 2rem;
    border-bottom: 1px solid #f0f0f0;
}

.course-detail-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #333;
}

.course-detail-content {
    padding: 2rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #333;
    border-left: 4px solid #667eea;
    padding-left: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 3rem 0;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #666;
    border-radius: 5px;
    transition: all 0.3s;
}

.pagination a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .current {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 1rem 0;
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: #667eea;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* AdSense placeholders */
.ad-banner {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin: 2rem 0;
    color: #6c757d;
}

/* Training provider dropdown specific styling */
.form-group select[name="provider"] {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-group select[name="provider"] option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

/* Rating System Styles */
.rating-form {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    transition: all 0.3s ease;
}

.rating-form:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.star-rating-input {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: center;
}

.star-rating-input .star {
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ddd;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.star-rating-input .star:hover {
    color: #ffa500;
    transform: scale(1.1);
}

.star-rating-input .star.active {
    color: #ffa500;
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0 1rem 0;
    font-weight: 500;
}

.rating-message {
    min-height: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.rating-message.success {
    color: #28a745;
}

.rating-message.error {
    color: #dc3545;
}

.course-rating {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.course-rating .stars {
    color: #ffa500;
    font-size: 1.1rem;
}

.rating-text {
    color: #666;
    font-weight: 500;
}

/* Button styles for rating submission */
.btn.btn-rating {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
}

.btn.btn-rating:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.btn.btn-rating:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero {
        padding: 3rem 0;
    }
    
    .search-form {
        margin: -30px auto 2rem;
        padding: 1.5rem;
    }
    
    .search-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
    
    .form-group {
        width: 100%;
    }
    
    .form-control {
        width: 100%;
        min-width: 0;
        font-size: 16px; /* Prevents zoom on mobile */
    }
    
    .form-group select[name="provider"] {
        max-width: 100% !important;
        min-width: unset !important;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        padding: 15px;
        font-size: 1.1rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .course-meta {
        grid-template-columns: 1fr;
    }
    
    .course-actions {
        flex-direction: column;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 1.7rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .search-form {
        margin: -20px auto 1.5rem;
        padding: 1rem;
    }
    
    .search-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .form-control {
        padding: 14px 12px;
        font-size: 16px; /* Prevents zoom on iPhone */
    }
    
    .btn {
        width: 100% !important;
        padding: 16px;
        font-size: 1rem;
        margin-top: 0.5rem;
    }
    
    .course-card {
        margin-bottom: 1rem;
    }
    
    .course-header,
    .course-content {
        padding: 1rem;
    }
    
    .course-detail-header,
    .course-detail-content {
        padding: 1.5rem;
    }
    
    .results-header {
        gap: 0.5rem;
    }
    
    .sort-controls {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Loading states */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Training provider dropdown styling */
.form-group select[name="provider"] {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 200px;
}

.form-group select[name="provider"] option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 8px 12px;
}

/* Ensure dropdown doesn't break layout on smaller screens */
@media (max-width: 1024px) and (min-width: 769px) {
    .form-group select[name="provider"] {
        max-width: 300px !important;
    }
    
    .search-row {
        grid-template-columns: 1fr 1fr auto;
        gap: 1rem;
    }
}

/* Additional mobile improvements */
@media (max-width: 600px) {
    .hero-cta {
        display: block;
        width: fit-content;
        margin: 0 auto;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }
    
    .search-form {
        border-radius: 8px;
    }
    
    /* Mobile-first approach - ensure vertical layout on small screens */
    .search-row {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto auto;
        gap: 1.2rem;
        align-items: stretch;
    }
    
    .form-group {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .form-control {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    .btn {
        width: 100% !important;
        justify-self: stretch;
    }
}

/* Social Sharing Styles */
.social-sharing {
    margin: 1rem 0;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
    width: 100%;
    background: #6c757d;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.share-btn:active {
    transform: translateY(0);
}

.share-btn svg {
    flex-shrink: 0;
}

/* Individual platform colors */
.facebook-share {
    background: #1877f2;
}

.facebook-share:hover {
    background: #166fe5;
}

.twitter-share {
    background: #000000;
}

.twitter-share:hover {
    background: #333333;
}

.whatsapp-share {
    background: #25d366;
}

.whatsapp-share:hover {
    background: #20ba5a;
}

.copy-link {
    background: #6c757d;
}

.copy-link:hover {
    background: #5a6268;
}

.native-share {
    background: #007bff;
}

.native-share:hover {
    background: #0056b3;
}

/* Responsive design for share buttons */
@media (min-width: 768px) {
    .share-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .share-btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }
    
    .share-btn span {
        display: none;
    }
}

@media (min-width: 992px) {
    .share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        justify-content: flex-start;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .share-btn span {
        display: inline;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
