/* Base Styles */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3bc14a;
    --accent-color: #f72585;
    --text-color: #2b2d42;
    --background-color: #f8f9fa;
    --card-background: #fff;
    --border-radius: 12px;
    --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
    --gradient-1: linear-gradient(135deg, #4361ee, #3a0ca3);
    --gradient-2: linear-gradient(135deg, #f72585, #b5179e);
    --gradient-3: linear-gradient(135deg, #3bc14a, #2ecc71);
}

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

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    background-image: url('data:image/svg+xml,%3Csvg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z" fill="%234361ee" fill-opacity="0.05" fill-rule="evenodd"/%3E%3C/svg%3E');
    padding: 10px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Typography */
h1, h2, h3 {
    margin-bottom: 15px;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    color: var(--primary-color);
}

h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
}

p {
    margin-bottom: 15px;
}

/* Layout Components */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: #2d46cc; /* Solid background as fallback */
    background: var(--gradient-1);
    border-radius: var(--border-radius);
    color: white;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    opacity: 0.6;
    z-index: 0;
    animation: pulse 15s infinite linear;
}

header h1, header p {
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.2);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 8px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.95;
    background-color: rgba(0, 0, 0, 0.15);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 4px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) and (max-width: 1199px) {
    main {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        grid-column: span 2;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (min-width: 1200px) {
    main.three-column {
        grid-template-columns: 1.2fr 1.2fr 1fr 220px;
        grid-template-areas:
            "generator math fortune sidebar";
    }

    main.three-column #generator {
        grid-area: generator;
    }

    main.three-column #math-problems {
        grid-area: math;
    }

    main.three-column #fortune {
        grid-area: fortune;
    }

    main.three-column .sidebar {
        grid-area: sidebar;
    }

    main.three-column section,
    main.three-column aside {
        height: auto;
    }
}

.card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    border-top: 5px solid var(--primary-color);
}

#generator {
    border-top-color: var(--primary-color);
}

#fortune {
    border-top-color: var(--accent-color);
}

#math-problems {
    border-top-color: var(--secondary-color);
}

.card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(-5px);
}

.card h2 {
    display: inline-block;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 3px solid;
    position: relative;
}

#generator h2 {
    border-color: var(--primary-color);
}

#fortune h2 {
    border-color: var(--accent-color);
}

#math-problems h2 {
    border-color: var(--secondary-color);
}

/* Form Elements */
.input-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 5px;
    font-weight: 600;
}

.label-hint {
    font-weight: normal;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-left: 4px;
}

input[type="number"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.options, .operations {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    background-color: #3a56d4;
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

button:active {
    transform: translateY(1px);
}

#generate-problems {
    margin-bottom: 15px;
    width: 100%;
}

.export-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

#export-txt {
    background-color: var(--secondary-color);
}

#export-txt:hover {
    background-color: #27ae60;
}

#export-csv {
    background-color: var(--accent-color);
}

#export-csv:hover {
    background-color: #e67e22;
}

/* Results Sections */
.results {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    word-wrap: break-word;
}

.fortune-result {
    background-color: #f9f9f9;
    background-image: url('data:image/svg+xml,%3Csvg width="52" height="26" viewBox="0 0 52 26" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23f72585" fill-opacity="0.05"%3E%3Cpath d="M10 10c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6h2c0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6h-2c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6 0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6zm25.464-1.95l8.486 8.486-1.414 1.414-8.486-8.486 1.414-1.414z" /%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
    padding: 30px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    text-align: center;
    min-height: 150px;
    position: relative;
    border: 1px solid rgba(247, 37, 133, 0.1);
    box-shadow: 0 10px 30px rgba(247, 37, 133, 0.07);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.fortune-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 15px;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
}


.fortune-number::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 3px;
    background: var(--gradient-2);
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px;
}

.fortune-message {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 15px;
    line-height: 1.4;
    color: var(--text-color);
}

.fortune-interpretation {
    font-style: italic;
    color: #666;
    font-size: 0.95rem;
}

.social-share {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.social-share button {
    padding: 8px 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.social-share button i {
    font-size: 1.1rem;
}

.twitter-share {
    background-color: #1DA1F2;
}

.twitter-share:hover {
    background-color: #0d8bd9;
}

.facebook-share {
    background-color: #4267B2;
}

.facebook-share:hover {
    background-color: #365899;
}

.copy-share {
    background-color: #6c757d;
}

.copy-share:hover {
    background-color: #5a6268;
}

#print-problems {
    background-color: #6c757d;
}

#print-problems:hover {
    background-color: #5a6268;
}

.problems-container {
    margin-top: 20px;
}

.problems-container button {
    margin-right: 10px;
    margin-bottom: 10px;
}

.problems, .answers {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 15px 0;
}

.problem-item, .answer-item {
    margin-bottom: 10px;
    padding: 10px;
    background-color: white;
    border-radius: var(--border-radius);
}

.hidden {
    display: none;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    color: #777;
    font-size: 0.9rem;
}

.footer-links {
    margin-top: 10px;
}

.footer-description {
    max-width: 800px;
    margin: 15px auto;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

.affiliate-disclosure {
    max-width: 800px;
    margin: 10px auto;
    font-size: 0.8rem;
    color: #777;
    line-height: 1.4;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

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

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

.mt-20 {
    margin-top: 20px;
}

/* Policy Pages Styles */
.policy-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
}

/* SEO Content Section */
.seo-content {
    background-color: #f8f9fa;
    padding: 40px 20px;
    margin-top: 50px;
    border-top: 1px solid #eee;
    color: #666;
}

.seo-content .container {
    max-width: 1200px;
    margin: 0 auto;
}

.seo-content h2 {
    text-align: center;
    color: #555;
    font-size: 1.6rem;
    margin-bottom: 30px;
    font-weight: 600;
}

.seo-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

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

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

.seo-column h3 {
    color: #444;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.seo-column p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.policy-section {
    margin-bottom: 30px;
}

.policy-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

.policy-section h4 {
    color: #444;
    margin: 20px 0 10px;
    font-size: 1.1rem;
}

.policy-section ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.policy-section li {
    margin-bottom: 8px;
}

.policy-section a {
    color: var(--primary-color);
    text-decoration: none;
}

.policy-section a:hover {
    text-decoration: underline;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 15px;
    border: 1px solid #eee;
}

.sidebar-section h3 {
    color: #666;
    margin-bottom: 12px;
    font-size: 0.95rem;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-recommendations {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.book-recommendations li {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-recommendations li:hover {
    transform: translateY(-3px);
}

.book-recommendations a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.book-info {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}

.book-recommendations li:hover .book-info {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #ddd;
}

.book-title {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: block;
}

.book-description {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    display: block;
    flex-grow: 1;
}

.amazon-link {
    display: inline-block;
    color: #ff9900;
    font-weight: 500;
    font-size: 0.8rem;
    margin-top: auto;
}

.amazon-link i {
    margin-right: 5px;
}

.affiliate-note {
    font-size: 0.75rem;
    color: #777;
    font-style: italic;
    text-align: center;
    margin-top: 10px;
    line-height: 1.3;
}

/* Fortune Recommendations */
.fortune-recommendations {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed #eee;
}

.recommendation-heading {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin-bottom: 12px;
    font-style: italic;
}

.fortune-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fortune-product {
    display: block;
    text-decoration: none;
    color: inherit;
    background-color: #f8f9fa;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 10px 12px;
    transition: all 0.2s ease;
}

.fortune-product:hover {
    background-color: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.product-name {
    display: block;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 5px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Reset flash animation removed */

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

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

.bounce {
    animation: bounce 1s;
}

.float {
    animation: float 3s infinite ease-in-out;
}

.shake {
    animation: shake 0.5s;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 1000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -10px);
    pointer-events: auto;
}

.toast.success {
    background-color: var(--secondary-color);
}

.toast.error {
    background-color: #e74c3c;
}

/* Layout Container Styles */
.layout-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

main.two-column {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

/* Sidebar Styles */
.sidebar {
    background: var(--accent-background);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    height: fit-content;
}

.amazon-products {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-top: 5px solid var(--accent-color);
}

.amazon-products h2 {
    color: var(--accent-color);
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.product-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-card {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

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

.product-card a {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.book-title {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.book-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.amazon-link {
    color: var(--accent-color);
    font-weight: 500;
    margin-top: 0.5rem;
}

.affiliate-note {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* How to Use Section */
.how-to-use {
    text-align: center;
    max-width: 1200px;
    margin: 3rem auto;
    padding: 2rem;
}

.tool-instructions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.instruction-block {
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-top: 5px solid var(--primary-color);
}

.instruction-block h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-color);
}

.instruction-block ol {
    padding-left: 1.5rem;
}

.instruction-block li {
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* SEO Content Section */
.seo-content {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.seo-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.seo-column {
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-top: 5px solid var(--secondary-color);
}

.seo-column h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .layout-container {
        grid-template-columns: 1fr;
    }

    main.two-column {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    main.two-column {
        grid-template-columns: 1fr;
    }
}

.additional-features {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.feature-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    color: white;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.feature-link:hover {
    background: var(--accent-color-dark);
}

.practice-tip {
    margin: 1.5rem 0;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.practice-tip .fas {
    color: var(--accent-color);
    font-size: 1.25rem;
}

.practice-tip em {
    font-style: italic;
}
