/* ==========================================================================
   TypesOfFabrics.com - Professional Mobile & Desktop Master Stylesheet
   ========================================================================== */

/* 1. Global Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --brand-navy: #0D2B45;
    --brand-blue: #1A456E;
    --brand-teal: #2DA4A7;
    --brand-teal-light: #e6f6f7;
    --bg-page: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

/* 2. Container & Layout Engine */
.tof-container {
    width: 100%;
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

@media (max-width: 640px) {
    .tof-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* 3. Responsive Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--brand-navy);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

h1 { font-size: clamp(1.85rem, 4vw, 2.75rem); letter-spacing: -0.8px; }
h2 { font-size: clamp(1.5rem, 3vw, 2.15rem); letter-spacing: -0.5px; }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }
p { margin-bottom: 1rem; color: var(--text-secondary); }

/* 4. Responsive Grid Engine */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

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

@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }
}

/* 5. Mobile-Safe Responsive Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 550px; /* Ensures table doesn't cramp up on mobile */
    font-size: 0.92rem;
}

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

th {
    background-color: var(--brand-navy);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 0.3px;
}

tr:nth-child(even) {
    background-color: #F8FAFC;
}

tr:last-child td {
    border-bottom: none;
}

/* 6. Card & Component Styling */
.tof-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

@media (max-width: 640px) {
    .tof-card {
        padding: 1.15rem;
    }
}

/* 7. Buttons & Form Controls (Thumb Friendly for Touchscreens) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.65rem 1.25rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    min-height: 44px; /* Optimal tap target size */
}

.btn-primary {
    background: var(--brand-teal);
    color: #ffffff;
}
.btn-primary:hover {
    background: #258a8d;
}

.btn-navy {
    background: var(--brand-navy);
    color: #ffffff;
}
.btn-navy:hover {
    background: var(--brand-blue);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--brand-navy);
}
.btn-outline:hover {
    background: #f1f5f9;
}

/* Form Inputs */
input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: 44px;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px rgba(45, 164, 167, 0.15);
}

/* 8. Badge & Tags */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-teal { background: var(--brand-teal-light); color: var(--brand-teal); }
.badge-navy { background: #e2e8f0; color: var(--brand-navy); }

/* 9. Utility Classes */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-4 { margin-top: 2rem; }

/* Image Responsiveness */
img {
    max-width: 100%;
    height: auto;
    display: block;
}
