/* 
 * ContractorDocs Main Stylesheet
 * Clean, professional design for trade professionals
 */

/* CSS Variables - Easy theming */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #1e293b;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-gray: #f1f5f9;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --max-width: 1200px;
    --header-height: 70px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-white);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 24px;
}

.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Nav CTA buttons - override nav link styles */
/* Specificity must beat .nav-links a:hover / .nav-links a.active */
.nav-links a.btn {
    padding: 8px 16px;
}

.nav-links a.btn-primary {
    color: #fff;
    -webkit-text-fill-color: #fff;
}

/* States kept in separate rules: one invalid/unsupported selector in a
   list would otherwise drop the whole rule in some browsers. */
.nav-links a.btn-primary:link { color: #fff; -webkit-text-fill-color: #fff; }
.nav-links a.btn-primary:visited { color: #fff; -webkit-text-fill-color: #fff; }
.nav-links a.btn-primary:hover { color: #fff; -webkit-text-fill-color: #fff; }
.nav-links a.btn-primary:focus { color: #fff; -webkit-text-fill-color: #fff; }
.nav-links a.btn-primary:focus-visible { color: #fff; -webkit-text-fill-color: #fff; }
.nav-links a.btn-primary:active { color: #fff; -webkit-text-fill-color: #fff; }
.nav-links a.btn-primary.active { color: #fff; -webkit-text-fill-color: #fff; }

.nav-links a.btn-primary {
    background: var(--primary-color);
}

.nav-links a.btn-primary:hover,
.nav-links a.btn-primary:focus,
.nav-links a.btn-primary:active,
.nav-links a.btn-primary.active {
    background: var(--primary-dark);
}

.nav-links a.btn-primary:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

/* No link underline on the CTA button */
.nav-links a.btn::after,
.nav-links a.btn.active::after {
    content: none;
    display: none;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 5px 0;
    transition: 0.3s;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--bg-gray);
    color: var(--text-primary);
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

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

.btn-accent:hover {
    background: #d97706;
    color: white;
}

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

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #334155 100%);
    color: white;
    padding: 80px 0;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: #cbd5e1;
    max-width: 600px;
}

.hero-content {
    max-width: 650px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
}

/* Features Grid */
.features {
    padding: 80px 0;
    background: var(--bg-light);
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 48px;
}

.section-header h2 {
    margin-bottom: 16px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-gray);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-body {
    padding: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.card-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

/* Template Cards */
.template-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.template-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.template-preview {
    background: var(--bg-gray);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    border-bottom: 1px solid var(--border-color);
}

.template-preview img {
    max-height: 180px;
    box-shadow: var(--shadow-md);
}

.template-info {
    padding: 20px;
}

.template-info h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.template-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.template-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Email Signup */
.email-signup {
    background: var(--secondary-color);
    padding: 60px 0;
    color: white;
}

.email-signup h2 {
    color: white;
    text-align: center;
    margin-bottom: 8px;
}

.email-signup p {
    text-align: center;
    color: #cbd5e1;
    margin-bottom: 24px;
}

.email-form {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
}

.email-form input {
    flex: 1;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: #94a3b8;
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 48px;
    margin-bottom: 48px;
}

.footer-brand p {
    margin-top: 16px;
    font-size: 0.875rem;
}

.footer-links h4 {
    color: white;
    font-size: 1rem;
    margin-bottom: 16px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: #94a3b8;
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.875rem;
}

.footer-legal {
    display: flex;
    gap: 24px;
}

/* Page Header */
.page-header {
    background: var(--bg-light);
    padding: 48px 0;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    max-width: 700px;
}

/* Content Sections */
.section {
    padding: 60px 0;
}

.section-alt {
    background: var(--bg-light);
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-free {
    background: #d1fae5;
    color: #065f46;
}

.badge-paid {
    background: #fef3c7;
    color: #92400e;
}

.badge-new {
    background: #dbeafe;
    color: #1e40af;
}

/* Alert/Notice Boxes */
.notice {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.notice-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.notice-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.notice-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.notice-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Article Styles */
.article {
    max-width: 800px;
    margin: 0 auto;
}

.article-content {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.article-content h2 {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.article-content h3 {
    margin-top: 1.5rem;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

/* CTA Box */
.cta-box {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin: 32px 0;
}

.cta-box h3 {
    color: white;
    margin-bottom: 12px;
}

.cta-box p {
    opacity: 0.9;
    margin-bottom: 20px;
}

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

.cta-box .btn:hover {
    background: var(--bg-light);
}

/* Table Styles */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-light);
    font-weight: 600;
}

tr:hover td {
    background: var(--bg-light);
}

/* Pricing/Pack Section */
.pack-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 32px 0;
}

.pack-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.pack-feature-icon {
    color: var(--success-color);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.pack-feature h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.pack-feature p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Pricing Card */
.pricing-card {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.pricing-header {
    background: var(--primary-color);
    color: white;
    padding: 32px;
}

.pricing-header h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 3rem;
    font-weight: 700;
}

.pricing-price span {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
}

.pricing-body {
    padding: 32px;
}

.pricing-features {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
}

.pricing-features li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.pricing-features li:last-child {
    border-bottom: none;
}

.pricing-features .check {
    color: var(--success-color);
    font-weight: bold;
}

/* Privacy Badge */
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.privacy-badge svg {
    width: 16px;
    height: 16px;
}

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

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.py-1 { padding-top: 8px; padding-bottom: 8px; }
.py-2 { padding-top: 16px; padding-bottom: 16px; }
.py-3 { padding-top: 24px; padding-bottom: 24px; }
.py-4 { padding-top: 32px; padding-bottom: 32px; }

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

/* Responsive */
@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .nav-links {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--border-color);
    }
    
    .nav-links.active {
        display: flex;
    }

    /* Mobile dropdown CTA: full-width, comfortable, white on blue */
    .nav-links.active a.btn-primary,
    .nav-links a.btn-primary {
        align-self: stretch;
        width: 100%;
        margin-top: 8px;
        padding: 12px 18px;
        font-weight: 600;
        text-align: center;
        color: #fff;
        -webkit-text-fill-color: #fff;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .hero {
        padding: 48px 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .features {
        padding: 48px 0;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .email-form {
        flex-direction: column;
    }
    
    .email-form .btn {
        width: 100%;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-legal {
        justify-content: center;
    }
    
    .cta-box {
        padding: 24px;
    }
    
    .pricing-price {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .template-actions {
        flex-direction: column;
    }
    
    .template-actions .btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .email-signup,
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
}

.cta-box .pack-cta-btn {
    background: var(--accent-color);
    color: white;
    font-size: 1.125rem;
    padding: 16px 32px;
}
.cta-box .pack-cta-btn:hover { background: var(--accent-color); filter: brightness(0.92); }

/* Pack page hero (layout moved out of inline styles) */
.pack-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}
.pack-hero-grid > * { min-width: 0; }
.pack-price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
    margin: 32px 0;
}
.pack-hero-cta {
    width: 100%;
    max-width: 300px;
    margin-bottom: 16px;
}
.pack-preview-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 32px;
}
.pack-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    .pack-hero-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .pack-preview-panel { padding: 20px; }
    .pack-preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .pack-price-row { margin: 24px 0; }

    /* Primary buy CTAs: full width, comfortable tap height */
    .pack-hero-cta,
    .cta-box .btn,
    .pricing-card .btn-accent,
    .card .btn-primary,
    .card .btn-secondary {
        width: 100%;
        max-width: none;
        min-height: 48px;
        text-align: center;
    }
    .cta-box .btn { white-space: normal; }
    .cta-box .pack-cta-btn { padding: 14px 20px; }
    .cta-box > div[style*="flex"] { flex-direction: column; }
    .cta-box > div[style*="flex"] .btn { width: 100%; }
}

@media (max-width: 480px) {
    th, td { padding: 10px 8px; }
    table { font-size: 0.9375rem; }
    .pack-preview-panel { padding: 16px; }
}
