/* Insight Mathematics Worksheet Styles */
/* Shared styles for circular functions worksheets */

:root { 
    --primary: #2c3e50; 
    --accent: #3498db; 
}

* { 
    box-sizing: border-box; 
}

body {
    font-family: Georgia, serif;
    line-height: 1.8;
    color: #333;
    background: #fafafa;
    margin: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.container { 
    max-width: 800px; 
    margin: 0 auto; 
    padding: 20px; 
}

.welcome-page {
    background: linear-gradient(135deg, #2d5a27, #1e3d1a);
    color: white;
    padding: 30px 30px;
    text-align: left;
    border-radius: 8px;
    margin-top: 10px;
    position: relative;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.welcome-page h1 {
    font-size: 2em;
    margin: 0 0 20px;
    font-weight: normal;
    text-align: center;
}

.welcome-page h2 {
    font-size: 1.3em;
    margin: 20px 0 10px;
    color: white;
    border: none;
    padding: 0;
}

.welcome-content {
    max-width: 700px;
    margin: 0 auto;
}

.welcome-content p {
    font-size: 1em;
    line-height: 1.6;
}

.navigation-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 5px;
    border-left: 4px solid rgba(255, 255, 255, 0.5);
    margin: 15px 0;
}

.navigation-box h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.welcome-content .navigation-box ul {
    margin: 0;
    padding: 0 0 0 20px;
    background: transparent;
}

.welcome-content ul {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px 15px 40px;
    border-radius: 5px;
    margin: 15px 0;
}

.welcome-content li {
    margin: 8px 0;
    line-height: 1.5;
    font-size: 0.95em;
}

.welcome-tip {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 15px;
    border-radius: 5px;
    border-left: 4px solid rgba(255, 255, 255, 0.5);
    margin: 15px 0;
    font-weight: bold;
    font-size: 1em;
}

.welcome-author {
    text-align: right;
    margin-top: 20px;
    opacity: 0.9;
    font-size: 1em;
    line-height: 1.6;
}

.welcome-logo {
    position: absolute;
    bottom: 35px;
    left: 30px;
    width: 50px;
    height: 50px;
    opacity: 0.7;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .welcome-page {
        padding: 20px 20px;
        margin-top: 5px;
    }

    .welcome-page h1 {
        font-size: 1.6em;
        margin-bottom: 15px;
    }

    .welcome-page h2 {
        font-size: 1.1em;
    }

    .welcome-content p {
        font-size: 0.95em;
    }

    .welcome-content li {
        font-size: 0.9em;
        margin: 6px 0;
    }

    .welcome-logo {
        width: 40px;
        height: 40px;
        bottom: 25px;
    }
}

.title-page {
    background: linear-gradient(135deg, var(--primary), #1a252f);
    color: white;
    padding: 80px 40px;
    text-align: center;
    border-radius: 8px;
    margin-top: 40px;
}

.title-page h1 { 
    font-size: 2.5em; 
    margin: 0 0 10px; 
    font-weight: normal; 
}

.title-page .subtitle { 
    font-size: 1.8em; 
    opacity: 0.9; 
}

.title-page .author {
    text-align: right; 
    margin-top: 30px; 
    opacity: 0.8; 
    font-size: 1.2em
}

.title-page a { 
    color: #87ceeb; 
}

h2.chapter { 
    font-size: 1.8em; 
    color: var(--primary); 
    margin: 50px 0 20px; 
    padding-bottom: 10px; 
    border-bottom: 3px solid var(--accent); 
}

h3.section { 
    font-size: 1.4em; 
    color: var(--primary); 
    margin: 40px 0 15px; 
    font-style: normal; 
}

h2 { 
    font-size: 1.8em; 
    color: var(--primary); 
    margin: 50px 0 20px; 
    padding-bottom: 10px; 
    border-bottom: 3px solid var(--accent); 
}

h3 { 
    font-size: 1.4em; 
    color: var(--primary); 
    margin: 40px 0 15px; 
}

p { 
    margin: 15px 0; 
}

p.small {
    line-height: 0.7;
}

.intro { 
    font-style: normal; 
    color: #555; 
    background: #f5f5f5; 
    padding: 15px 20px; 
    border-radius: 5px; 
    border-left: 4px solid var(--accent); 
    margin: 20px 0; 
}

.key-concept { 
    background: linear-gradient(135deg, #e8f4f8, #d1e8f0); 
    padding: 20px 25px; 
    border-radius: 8px; 
    margin: 25px 0; 
    border-left: 5px solid var(--accent); 
}

.exercise { 
    background: #fff9e6; 
    padding: 15px 20px; 
    border-radius: 5px; 
    margin: 20px 0; 
    border: 1px solid #f0e0a0; 
    border-left: 4px solid #d4a000; 
}

.answer { 
    background: #e8f8e8; 
    padding: 12px 20px; 
    border-radius: 5px; 
    margin: 15px 0; 
    border-left: 4px solid #4a4; 
}

.teacher-note { 
    display: none; 
    background: #e8f0ff; 
    padding: 15px 20px; 
    border-radius: 5px; 
    margin: 20px 0; 
    border-left: 4px solid #0066cc; 
    color: #0066cc; 
}

.math-block { 
    text-align: center; 
    margin: 20px 0; 
    padding: 15px; 
    font-size: 1.1em; 
}

figure { 
    margin: 30px 0; 
    text-align: center; 
}

figure img {
    max-width: 85%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

figure video { 
    max-width: 72%; 
    height: auto; 
    border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
}

footer { 
    text-align: center; 
    padding: 40px 20px; 
    margin-top: 60px; 
    background: var(--primary); 
    color: white; 
}

footer a { 
    color: #87ceeb; 
}

/* Reader-specific styles */
.page {
    display: none;
    min-height: 60vh;
    padding-bottom: 100px;
}

.page.active {
    display: block;
}

.navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary), #1a252f);
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.navigation.visible {
    transform: translateY(0);
}

.nav-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: Georgia, serif;
}

.nav-btn:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
}

.nav-btn:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.page-indicator {
    color: white;
    font-size: 1.1em;
    min-width: 150px;
    text-align: center;
}

#pageInput {
    width: 50px;
    padding: 5px;
    font-size: 1em;
    font-family: Georgia, serif;
    text-align: center;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.9);
    color: #333;
}

#pageInput:focus {
    outline: 2px solid var(--accent);
}

#pageInput::-webkit-outer-spin-button,
#pageInput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#pageInput {
    -moz-appearance: textfield;
    appearance: textfield;
}

img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.answer-options {
    margin: 20px 0;
    padding-left: 40px;
}

.answer-options p {
    margin: 10px 0;
}

.correct-answer {
    color: #2a7a2a;
    font-weight: bold;
}

.two-column {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    gap: 20px;
}

.two-column figure {
    flex: 1;
    margin: 0;
}

.two-column figure img {
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

td {
    padding: 12px 10px;
    vertical-align: middle;
}

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

.toc-item {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    padding: 10px 0;
    border-bottom: 1px dotted #ccc;
}

.toc-item .topic {
    flex: 1;
}

.toc-item .description {
    text-align: right;
    color: #666;
    font-style: normal;
}

.toc-highlight {
    font-weight: bold;
    background: #fff9e6;
    border-radius: 5px;
    border-bottom: none;
}

.math-table {
    margin: 20px auto;
    text-align: center;
}

.math-table td {
    padding: 8px 20px;
    text-align: center;
}

.math-table tr:nth-child(even) {
    background: transparent;
}

ul {
    margin: 15px 0;
    padding-left: 25px;
}

li {
    margin: 8px 0;
}

/* Side navigation arrows for touch devices */
.side-nav-prev,
.side-nav-next {
    display: none;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 72px;
    background: transparent;
    color: rgba(44, 62, 80, 0.4);
    border: none;
    font-size: 2em;
    cursor: pointer;
    z-index: 999;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
}

.side-nav-prev {
    left: 0;
}

.side-nav-next {
    right: 0;
}

.touch-device .side-nav-prev,
.touch-device .side-nav-next {
    display: flex;
}

.side-nav-prev:disabled,
.side-nav-next:disabled {
    opacity: 0.12;
}

.side-nav-prev:active:not(:disabled),
.side-nav-next:active:not(:disabled) {
    color: rgba(44, 62, 80, 0.8);
}

/* Mobile nav bar: lighter background, hide prev/next (side arrows cover those) */
.touch-device .navigation {
    background: rgba(44, 62, 80, 0.75);
}

.touch-device #prevBtn,
.touch-device #nextBtn {
    display: none;
}

/* First/last buttons transparent on mobile so emoji box blends into nav bar */
.touch-device #firstBtn,
.touch-device #lastBtn {
    background: transparent;
}

/* Scroll-down indicator for touch devices */
@keyframes bounce-down {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(6px); }
}

.scroll-down-indicator {
    display: none;
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(44, 62, 80, 0.35);
    font-size: 1.8em;
    z-index: 998;
    pointer-events: none;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
    animation: bounce-down 1.6s ease-in-out infinite;
}

.touch-device .scroll-down-indicator {
    display: block;
}

.touch-device .scroll-down-indicator.hidden {
    display: none;
}

/* Back button */
.back-nav {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(44, 62, 80, 0.85);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.2em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.2s;
}

.back-btn:hover {
    background: rgba(44, 62, 80, 1);
    transform: scale(1.05);
}

/* Matrix row styling for inverse functions worksheet */
.matrix-row {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-row.exercise,
.matrix-row.answer {
    padding: 15px 20px;
}
