/**
 * Meta Title Analyzer & SERP Preview Tool - Custom Styles
 * 
 * Specialized CSS for accurate SERP previews, responsive design,
 * and enhanced user experience for the meta title analyzer tool.
 */

/* Title Analysis Form Styling */
.title-analysis-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-switch .form-check-input:checked {
    background-color: var(--bs-success);
    border-color: var(--bs-success);
}

/* Custom Title Counter */
.custom-title-counter {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Results Section */
#resultsSection {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 3px solid var(--bs-primary);
}

[data-bs-theme="dark"] #resultsSection {
    background: linear-gradient(135deg, #1a1d23 0%, #2d2d2d 100%);
}

/* Analysis Summary Cards */
.analysis-card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.analysis-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Title Text Display */
.title-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bs-dark);
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--bs-primary);
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] .title-text {
    background: #2d2d2d;
    color: #e9ecef;
}

/* Length Analysis Bars */
.length-bar {
    height: 20px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.length-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    position: relative;
}

.length-bar-fill.good {
    background: linear-gradient(90deg, #198754, #20c997);
}

.length-bar-fill.caution {
    background: linear-gradient(90deg, #fd7e14, #ffc107);
}

.length-bar-fill.warning {
    background: linear-gradient(90deg, #dc3545, #fd5c70);
}

.length-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* SERP Preview Cards */
.serp-preview-card {
    border: 2px solid #e9ecef;
    border-radius: 0.75rem;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.serp-preview-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.15);
}

[data-bs-theme="dark"] .serp-preview-card {
    background: #2d2d2d;
    border-color: #404040;
}

.serp-engine-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
}

.serp-preview-content {
    padding: 1.25rem;
    padding-top: 3rem;
}

/* Individual SERP Styles */

/* Google SERP Preview */
.serp-google .serp-title {
    color: #1a0dab;
    font-size: 18px;
    line-height: 1.3;
    font-family: arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.serp-google .serp-title:hover {
    text-decoration: underline;
}

.serp-google .serp-url {
    color: #006621;
    font-size: 14px;
    font-family: arial, sans-serif;
    margin: 2px 0 3px 0;
}

.serp-google .serp-description {
    color: #545454;
    font-size: 14px;
    line-height: 1.4;
    font-family: arial, sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Google Mobile SERP */
.serp-google.mobile .serp-title {
    font-size: 16px;
    font-weight: 400;
}

.serp-google.mobile .serp-url {
    font-size: 12px;
}

.serp-google.mobile .serp-description {
    font-size: 13px;
}

/* Bing SERP Preview */
.serp-bing .serp-title {
    color: #0060df;
    font-size: 18px;
    line-height: 1.3;
    font-family: "Segoe UI", arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.serp-bing .serp-title:hover {
    text-decoration: underline;
}

.serp-bing .serp-url {
    color: #006621;
    font-size: 13px;
    font-family: "Segoe UI", arial, sans-serif;
    margin: 2px 0 3px 0;
}

.serp-bing .serp-description {
    color: #666666;
    font-size: 13px;
    line-height: 1.4;
    font-family: "Segoe UI", arial, sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Yahoo SERP Preview */
.serp-yahoo .serp-title {
    color: #400090;
    font-size: 18px;
    line-height: 1.3;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.serp-yahoo .serp-title:hover {
    text-decoration: underline;
}

.serp-yahoo .serp-url {
    color: #008000;
    font-size: 13px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    margin: 2px 0 3px 0;
}

.serp-yahoo .serp-description {
    color: #666666;
    font-size: 13px;
    line-height: 1.4;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* DuckDuckGo SERP Preview */
.serp-duckduckgo .serp-title {
    color: #0969da;
    font-size: 18px;
    line-height: 1.3;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.serp-duckduckgo .serp-title:hover {
    text-decoration: underline;
}

.serp-duckduckgo .serp-url {
    color: #006621;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 2px 0 3px 0;
}

.serp-duckduckgo .serp-description {
    color: #666666;
    font-size: 13px;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Truncation Indicator */
.title-truncated::after {
    content: "⚠️";
    margin-left: 5px;
    color: #dc3545;
    font-size: 0.8em;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .serp-preview-card {
        margin-bottom: 1rem;
    }
    
    .serp-preview-content {
        padding: 1rem;
        padding-top: 2.5rem;
    }
    
    .serp-engine-badge {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Mobile-specific SERP adjustments */
    .mobile .serp-title {
        font-size: 16px !important;
    }
    
    .mobile .serp-url {
        font-size: 12px !important;
    }
    
    .mobile .serp-description {
        font-size: 13px !important;
    }
}

/* Warning and Info Alerts */
.warning-card {
    border-left: 4px solid #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.info-card {
    border-left: 4px solid #0dcaf0;
    background: rgba(13, 202, 240, 0.05);
}

.caution-card {
    border-left: 4px solid #ffc107;
    background: rgba(255, 193, 7, 0.05);
}

/* Optimization Tips */
.optimization-tip {
    transition: all 0.3s ease;
}

.optimization-tip:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.priority-high {
    border-left: 4px solid #dc3545;
}

.priority-medium {
    border-left: 4px solid #ffc107;
}

.priority-low {
    border-left: 4px solid #6c757d;
}

/* Device Preview Toggle */
.device-toggle {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 2rem;
    padding: 0.25rem;
}

.device-toggle .btn {
    border-radius: 1.5rem;
    min-width: 120px;
}

/* Loading Animation */
.serp-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.serp-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.serp-skeleton.title {
    height: 20px;
    width: 80%;
}

.serp-skeleton.url {
    height: 14px;
    width: 60%;
}

.serp-skeleton.description {
    height: 14px;
    width: 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Character Counter Animation */
.char-counter {
    transition: color 0.3s ease;
}

.char-counter.good {
    color: #198754;
}

.char-counter.caution {
    color: #fd7e14;
}

.char-counter.warning {
    color: #dc3545;
}

/* Interactive Elements */
.interactive-preview:hover .serp-title {
    text-decoration: underline !important;
}

/* Accessibility Improvements */
.visually-hidden-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus states for keyboard navigation */
.serp-preview-card:focus-within {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .serp-preview-card {
        break-inside: avoid;
        border: 1px solid #ddd !important;
    }
    
    .btn, .nav-pills {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .serp-title {
        font-weight: 600 !important;
    }
    
    .serp-preview-card {
        border-width: 3px !important;
    }
}

/* Mobile view indicator */
.mobile-indicator {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
}

.mobile-indicator small {
    display: inline-flex;
    align-items: center;
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

[data-bs-theme="dark"] .mobile-indicator {
    border-top-color: #404040;
}

[data-bs-theme="dark"] .mobile-indicator small {
    background: rgba(13, 110, 253, 0.2);
    color: #6ea8fe;
}

/* Enhanced mobile differences */
.mobile .serp-preview-content {
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
    border-radius: 0.5rem;
    margin: -0.25rem;
    padding: 1rem;
}

[data-bs-theme="dark"] .mobile .serp-preview-content {
    background: linear-gradient(to bottom, #1a1d23, #2d2d2d);
}

/* Ring SEO Score */
.ring-score {
    width: 120px;
    height: 120px;
    position: relative;
    margin: 0 auto 20px;
}

.ring-score svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-score .ring-bg {
    fill: none;
    stroke: var(--bs-border-color, #e9ecef);
    stroke-width: 8;
}

[data-bs-theme="dark"] .ring-score .ring-bg {
    stroke: var(--bs-border-color, #495057);
}

.ring-score .ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease-in-out;
}

.ring-score .score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ring-score .score-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--bs-body-color, #333);
    line-height: 1;
    margin-bottom: 4px;
}

.ring-score .score-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-secondary-color, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Horizontal Progress Bar */
.seo-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bs-border-color, #e9ecef);
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

[data-bs-theme="dark"] .seo-progress-bar {
    background-color: var(--bs-border-color, #495057);
}

.seo-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1.5s ease-in-out;
}

.seo-score-text {
    text-align: center;
    margin: 10px 0;
    font-size: 0.9rem;
    color: var(--bs-secondary-color, #6c757d);
    font-weight: 500;
}

/* Quick Stats Section */
.quick-stats-section {
    background: var(--bs-light, #f8f9fa);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--bs-border-color, #e9ecef);
    margin-bottom: 16px;
}

[data-bs-theme="dark"] .quick-stats-section {
    background: var(--bs-dark, #212529);
    border-color: var(--bs-border-color, #495057);
}

.quick-stats-section h6 {
    margin-bottom: 16px;
    color: var(--bs-body-color, #495057);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.quick-stats-section h6 i {
    margin-right: 8px;
    color: var(--bs-secondary-color, #6c757d);
}

/* Quick Stats Grid - 2x2 Layout */
.quick-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.quick-stat-item {
    text-align: left;
}

.quick-stat-item .stat-label {
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
}

.quick-stat-item .stat-value {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--bs-primary, #0d6efd);
    line-height: 1.2;
}

.quick-stat-item .stat-value.good {
    color: #198754;
}

.quick-stat-item .stat-value.caution {
    color: #fd7e14;
}

.quick-stat-item .stat-value.warning {
    color: #dc3545;
}

.quick-stat-item .stat-value.primary {
    color: var(--bs-primary, #0d6efd);
}

.quick-stat-item .stat-value.info {
    color: var(--bs-info, #0dcaf0);
}

/* Strengths Section */
.strengths-section {
    background: var(--bs-light, #f8f9fa);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--bs-border-color, #e9ecef);
    margin-top: 16px;
}

[data-bs-theme="dark"] .strengths-section {
    background: var(--bs-dark, #212529);
    border-color: var(--bs-border-color, #495057);
}

.strengths-section h6 {
    margin-bottom: 12px;
    color: #198754;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.strengths-section h6 i {
    margin-right: 8px;
}

.strength-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #d4f6dd;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #a7e6b7;
}

[data-bs-theme="dark"] .strength-item {
    background-color: rgba(25, 135, 84, 0.2);
    border-color: rgba(25, 135, 84, 0.3);
}

.strength-item:last-child {
    margin-bottom: 0;
}

.strength-item i {
    color: #198754;
    margin-right: 8px;
    font-size: 0.9rem;
}

.strength-item span {
    color: #0f5132;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
}

[data-bs-theme="dark"] .strength-item span {
    color: #a7e6b7;
}

@media (max-width: 575px) {
    .quick-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .analysis-card,
    .optimization-tip,
    .length-bar-fill {
        transition: none !important;
    }
    
    .serp-skeleton {
        animation: none !important;
    }
    
    .ring-score .ring-fill {
        transition: none !important;
    }
}
