/**
 * TypingSpeed - Main Stylesheet
 * 
 * Contains all custom styling for the typing speed test website
 */

/* Add AdSense container styles at the top of the style.css file */
/* AdSense Container Styles */
.ad-container {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin: 15px 0;
    min-height: 90px;
    overflow: hidden;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-container::before {
    content: 'Advertisement';
    display: block;
    font-size: 10px;
    color: #999;
    margin-bottom: -15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-ad {
    margin-bottom: 20px;
}

.content-ad {
    margin: 30px 0;
}

/* Image Alt Tag SEO Helper Classes */
.img-with-alt {
    position: relative;
}

.visually-hidden-alt {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------- General Styles ---------- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --body-font: 'Poppins', sans-serif;
    --mono-font: 'Roboto Mono', monospace;
    --body-bg: #ffffff;
    --body-color: #212529;
    --card-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --border-radius: 0.25rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition-speed: 0.3s;
    --container-max-width: 1140px; /* Maximum content width */
    --container-large-width: 960px; /* Width for large screens */
    --container-medium-width: 800px; /* Width for medium screens */
}

/* Reset margins and paddings */
html, body {
    height: 100%;
    font-family: var(--body-font);
    color: var(--body-color);
    background-color: var(--body-bg);
    overflow-x: hidden; /* Prevent horizontal scrolling */
    width: 100%;
    max-width: 100%;
}

body {
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    font-weight: 400;
    font-size: 16px;
    position: relative;
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #0069d9;
    border-color: #0062cc;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
}

/* Card Shadows & Borders */
.card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.shadow-sm {
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .175) !important;
}

/* Navigation */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #fff;
    font-weight: 500;
}

/* ---------- Page Specific Styles ---------- */

/* Header & Footer */
.site-header {
    margin-bottom: 2rem;
    width: 100%;
}

.site-footer {
    margin-top: auto;
    padding: 3rem 0;
    width: 100%;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #ffffff;
    text-decoration: none;
}

.footer-links a {
    display: inline-block;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
    border-left: 2px solid transparent;
}

.footer-links a:hover {
    border-left-color: var(--primary-color);
    padding-left: 0.75rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    transition: all 0.3s;
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.newsletter-form .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    height: 42px;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.newsletter-form .form-control:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
    color: #ffffff;
}

.newsletter-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Homepage Styles */
.feature-icon {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.step-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.25rem;
}

.avatar {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.25rem;
    background-color: var(--primary-color);
    color: white;
}

/* Typing Test Styles */
.typing-test-container {
    max-width: 1000px;
    margin: 0 auto;
}

.original-text {
    font-family: var(--mono-font);
    font-size: 1.1rem;
    line-height: 1.6;
    background-color: #f8f9fa;
}

#typed-text {
    font-family: var(--mono-font);
    font-size: 1.1rem;
    line-height: 1.6;
}

.timer {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--primary-color);
}

/* Results Styles */
.result-value {
    font-weight: 700;
    color: var(--primary-color);
}

/* Leaderboard Styles */
.leaderboard-container .badge {
    font-size: 85%;
}

.category-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.category-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* About Page Styles */
.quick-fact {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.quick-fact:last-child {
    border-bottom: none;
}

.fact-icon {
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--light-color);
}

/* Contact Page Styles */
.info-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--info-color);
}

/* 404 Page Styles */
.page-not-found {
    min-height: 60vh;
}

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 767.98px) {
    h1, .h1 {
        font-size: 2rem;
    }
    
    h2, .h2 {
        font-size: 1.75rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .original-text, #typed-text {
        font-size: 1rem;
    }
    
    .test-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
    }
    
    /* Fix for mobile view */
    .hero-section {
        padding: 2rem 0;
    }
    
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Make images responsive */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Make footer responsive */
    .site-footer {
        padding: 2rem 0;
    }
    
    /* Fix spacing in mobile */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

.container, 
.container-sm, 
.container-md, 
.container-lg, 
.container-xl, 
.container-xxl {
    width: 100%;
    padding-right: var(--bs-gutter-x, 0.75rem);
    padding-left: var(--bs-gutter-x, 0.75rem);
    margin-right: auto;
    margin-left: auto;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    flex: 1 0 auto;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

.hero-section {
    padding: 1.5rem 0;
    background-color: var(--light-color);
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075);
}

.typing-test-container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Responsive table styles */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Image responsiveness */
img {
    max-width: 100%;
    height: auto;
}

@media (min-width: 1400px) {
    .container,
    .container-xxl,
    .container-xl,
    .container-lg,
    .container-md,
    .container-sm {
        max-width: 1320px;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .container,
    .container-xl,
    .container-lg,
    .container-md,
    .container-sm {
        max-width: 1140px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm {
        max-width: 960px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .container,
    .container-md,
    .container-sm {
        max-width: 720px;
    }
}

/* Specific mobile fixes */
@media (max-width: 576px) {
    .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .col, [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Fix row in home page */
    .hero-section .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Button responsive fixes */
    .btn {
        white-space: normal;
    }
    
    /* Card fixes */
    .card {
        margin-left: 0;
        margin-right: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:focus {
    outline: 3px solid rgba(0, 123, 255, 0.25);
    outline-offset: 2px;
}

.text-muted {
    color: #6c757d !important;
    opacity: 0.8;
}

.visually-hidden {
    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;
} 