/* Base styles with responsive root font size */
:root {
    --nav-height: 4rem;
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #6B7280;
    --text-color: #111827;
    --text-muted: #4B5563;
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --border-color: #D1D5DB;
    --success-bg: #ECFDF5;
    --success-color: #047857;
    --error-bg: #FEF2F2;
    --error-color: #B91C1C;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
    --transition: all 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 576px) {
    html { font-size: 15px; }
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

@media (min-width: 1200px) {
    html { font-size: 17px; }
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: var(--nav-height); /* Space for mobile nav */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.min-h-screen {
    min-height: calc(100vh - var(--nav-height));
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Enhanced Navigation System */
.nav-header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
    position: fixed;
    z-index: 1000;
    width: 100%;
    bottom: 0;
    left: 0;
    height: var(--nav-height);
}

@media (min-width: 768px) {
    .nav-header {
        position: sticky;
        top: 0;
        bottom: auto;
        border-bottom: 1px solid var(--border-color);
    }
    
    .min-h-screen {
        min-height: 100vh;
    }
    
    body {
        padding-bottom: 0;
    }
}

.nav-content {
    display: flex;
    justify-content: space-between;
    height: var(--nav-height);
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.logo-link:hover {
    color: var(--primary-hover);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: bold;
    background: linear-gradient(to right, var(--primary-color), #7C3AED);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    margin-left: 2.5rem;
    gap: 1rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    color: var(--secondary-color);
}

.nav-link i {
    margin-right: 0.375rem;
    font-size: 1rem;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: #F9FAFB;
}

.nav-link.active {
    color: var(--primary-color);
    background-color: #EEF2FF;
}

/* Mobile Navigation */
@media (max-width: 767px) {
    .nav-links {
        display: flex;
        position: fixed;
        bottom: var(--nav-height);  /* Position above header */
        left: 0;
        right: 0;
        background: var(--card-bg);
        padding: 0.75rem 1rem;
        justify-content: space-around;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1001;  /* Higher than header */
        height: var(--nav-height);
    }

    .nav-link {
        flex-direction: column;
        padding: 0.5rem;
        font-size: 0.75rem;
        gap: 0.25rem;
        text-align: center;
        width: 100%;
    }
    
    .nav-link i {
        margin-right: 0;
        font-size: 1.25rem;
    }
    
    .nav-link span {
        display: block;
    }
}

/* Tablet+ */
@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

/* Main content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
}

/* Footer */
.footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--secondary-color);
    padding: 2rem 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-color);
}

h1 {
    font-size: 2.5rem;
    font-weight: bold;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
}

/* Breadcrumb Navigation */
.breadcrumb {
    margin: 1rem 0;
    font-size: 0.9rem;
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumb li {
    margin-right: 0.5rem;
}

.breadcrumb li:not(:last-child)::after {
    content: ">";
    margin-left: 0.5rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

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

.breadcrumb .active {
    color: var(--text-color);
    font-weight: 500;
}

/* Responsive adjustments for breadcrumb */
@media (max-width: 576px) {
    .breadcrumb {
        font-size: 0.8rem;
        margin: 0.5rem 0;
    }

    .breadcrumb li {
        margin-right: 0.25rem;
    }

    .breadcrumb li:not(:last-child)::after {
        margin-left: 0.25rem;
    }
}

/* Cards with Responsive Padding */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: var(--transition);
    padding: 1rem;
    border: 1px solid rgba(0,0,0,0.05);
}

@media (max-width: 576px) {
    .card {
        padding: 0.75rem; /* Reduced from 1rem to 0.75rem for mobile */
    }
}

@media (min-width: 576px) {
    .card {
        padding: 1.25rem;
    }
}

@media (min-width: 992px) {
    .card {
        padding: 1.5rem;
    }
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.card:hover .card-title {
    color: var(--primary-color);
}

.card-description {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.title-link {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
}

.title-link:hover {
    color: var(--primary-color);
}

/* Utility class for larger text */
.text-lg {
    font-size: 1.375rem; /* Increased from 1.125rem to ~19.25px at 14px base */
    color: var(--text-muted);
}

/* Category Grid for Desktop and Tablet */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem; /* Column gap */
    row-gap: 0.75rem; /* Increased row gap for spacing between rows */
    margin-top: 1rem;
    justify-content: center;
}

/* Update category-badge font size */
.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 1.20rem; /* Increased from 1rem to ~17.5px at 14px base */
    font-weight: 500;
    background-color: #EEF2FF;
    color: var(--primary-color);
    text-align: center; /* Added to center-align text */
    text-decoration: none;
    transition: var(--transition);
}

.category-badge:hover {
    background-color: var(--primary-color);
    color: white;
}

@media (max-width: 575px) {
    .category-grid {
        /* Keep vertical list on mobile */
        flex-direction: column;
        align-items: center;
        row-gap: 0.5rem; /* Further reduced for tighter spacing on small screens */
    }
    .category-grid .category-badge {
        width: 100%;
        text-align: center;
        margin-bottom: 0rem;
        font-size: 1.25rem; /* Consistent larger font on mobile */
        padding: 0.25rem 0.75rem;
    }
}

@media (min-width: 576px) {
    .category-grid {
        /* Tablet: 2-3 badges per row */
        flex-direction: row;
        justify-content: center;
        row-gap: 0.75rem; /* Consistent with base */
    }
    .category-grid .category-badge {
        flex: 0 0 auto;
        min-width: 6rem;
        text-align: center;
        font-size: 1.25rem; /* Consistent larger font */
        padding: 0.25rem 0.75rem;
    }
}

@media (min-width: 768px) {
    .category-grid {
        /* Desktop: 4-5 badges per row */
        justify-content: flex-start;
    }
    .category-grid .category-badge {
        min-width: 5rem;
        font-size: 1.25rem; /* Consistent larger font */
        padding: 0.25rem 0.75rem;
    }
}

.views-count {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.views-count i {
    margin-right: 0.25rem;
}

/* Responsive Grid System */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

@media (min-width: 576px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

@media (min-width: 992px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1400px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.pagination a:hover {
    background-color: #F9FAFB;
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Forms */
.form-container {
    max-width: 32rem;
    margin: 0 auto;
}

.form-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

@media (max-width: 768px) {
    .form-card {
        padding: 1.5rem;
    }
}

.form-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.form-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: #EEF2FF;
    color: var(--primary-color);
    border-radius: var(--radius-md);
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
    border-color: #A5B4FC;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.form-textarea {
    resize: vertical;
    min-height: 6rem;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.btn-secondary {
    background-color: white;
    color: var(--text-color);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: #F9FAFB;
}

.btn-full {
    width: 100%;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.alert-error {
    background-color: var(--error-bg);
    color: var(--error-color);
}

.alert i {
    margin-right: 0.5rem;
}

/* Loading animation */
@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: #f6f7f8;
}

.skeleton::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
    content: '';
}

.skeleton-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 75%;
    background-color: #E5E7EB;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.skeleton-text {
    height: 1rem;
    background-color: #E5E7EB;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 50%;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-1 {
    padding: 0.25rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* Theme toggle button */
.theme-toggle {
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    display: inline-flex;
    align-items: center;
}

/* Dark mode support */
html.dark-mode {
    --bg-color: #111827;
    --card-bg: #1F2937;
    --text-color: #F9FAFB;
    --text-muted: #D1D5DB;
    --border-color: #374151;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.3);
}

html.dark-mode .card {
    border-color: rgba(255,255,255,0.05);
}

html.dark-mode .form-input,
html.dark-mode .form-textarea,
html.dark-mode .form-select {
    background-color: #374151;
    border-color: #4B5563;
}

html.dark-mode .form-input:hover,
html.dark-mode .form-textarea:hover,
html.dark-mode .form-select:hover {
    border-color: #6B7280;
}

html.dark-mode .btn-secondary {
    background-color: #374151;
    color: #F9FAFB;
    border-color: #4B5563;
}

html.dark-mode .btn-secondary:hover {
    background-color: #4B5563;
}

html.dark-mode .pagination a {
    background-color: #1F2937;
    border-color: #374151;
}

html.dark-mode .pagination a:hover {
    background-color: #374151;
}

html.dark-mode .skeleton-title,
html.dark-mode .skeleton-text {
    background-color: #374151;
}

/* System preference dark mode support */
@media (prefers-color-scheme: dark) {
    html:not(.light-mode) {
        --bg-color: #111827;
        --card-bg: #1F2937;
        --text-color: #F9FAFB;
        --text-muted: #D1D5DB;
        --border-color: #374151;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.3);
    }
    
    html:not(.light-mode) .card {
        border-color: rgba(255,255,255,0.05);
    }
    
    html:not(.light-mode) .form-input,
    html:not(.light-mode) .form-textarea,
    html:not(.light-mode) .form-select {
        background-color: #374151;
        border-color: #4B5563;
    }
    
    html:not(.light-mode) .form-input:hover,
    html:not(.light-mode) .form-textarea:hover,
    html:not(.light-mode) .form-select:hover {
        border-color: #6B7280;
    }
    
    html:not(.light-mode) .btn-secondary {
        background-color: #374151;
        color: #F9FAFB;
        border-color: #4B5563;
    }
    
    html:not(.light-mode) .btn-secondary:hover {
        background-color: #4B5563;
    }
    
    html:not(.light-mode) .pagination a {
        background-color: #1F2937;
        border-color: #374151;
    }
    
    html:not(.light-mode) .pagination a:hover {
        background-color: #374151;
    }
    
    html:not(.light-mode) .skeleton-title,
    html:not(.light-mode) .skeleton-text {
        background-color: #374151;
    }
}

/* Additional responsive adjustments */
@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem; /* Reduced from 1rem to 0.5rem (7px at 14px base) */
    }
    
    .main-content {
        padding: 1.5rem 0.5rem; /* Reduced from 1rem to 0.5rem */
    }
    
    .card {
        padding: 0.75rem; /* Reduced from 0.875rem to 0.75rem */
    }
    
    .form-card {
        padding: 1rem; /* Reduced from 1.25rem to 1rem */
    }
    
    .btn {
        padding: 0.5rem 1rem; /* Reduced from 0.625rem 1.25rem to 0.5rem 1rem */
    }
}

/* Print styles */
@media print {
    body {
        background-color: white;
        color: black;
        font-size: 12pt;
    }
    
    .nav-header, 
    .footer,
    .pagination,
    .btn,
    .breadcrumb {
        display: none;
    }
    
    .container,
    .main-content {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    img {
        max-width: 100% !important;
    }
}

.seo-tool { padding: 2rem 0; }
.form-card { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.form-header { display: flex; align-items: center; gap: 1rem; }
.form-icon { font-size: 1.5rem; color: #007bff; }
.form-title { font-size: 1.8rem; margin: 0; }
.card-description { margin: 1rem 0; color: #555; }
.form-group { margin-bottom: 1.5rem; }
.form-label { font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }
.form-input, .form-textarea { width: 100%; padding: 0.8rem; border: 1px solid #ddd; border-radius: 4px; }
.form-textarea { height: 100px; resize: vertical; }
.count-display { font-size: 0.9rem; color: #555; margin-top: 0.5rem; }
.text-error { color: #dc3545; font-weight: bold; }
.serp-preview { margin-top: 2rem; padding: 1.5rem; background: #f9f9f9; border-radius: 8px; }
.serp-snippet { font-family: 'Roboto', sans-serif; }
.serp-title { font-size: 1.2rem; color: #1a0dab; margin-bottom: 0.3rem; }
.serp-url { font-size: 0.9rem; color: #006621; margin-bottom: 0.3rem; }
.serp-description { font-size: 0.9rem; color: #545454; }
.tooltip { cursor: help; background: #007bff; color: #fff; border-radius: 50%; width: 1rem; height: 1rem; text-align: center; line-height: 1rem; }
.tooltip-text { visibility: hidden; position: absolute; background: #333; color: #fff; padding: 0.5rem; border-radius: 4px; }
.tooltip:hover .tooltip-text { visibility: visible; }