/* DBMS Learning Mini Book - Common Styles */
/* Dark Mode Theme for Desktop */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-purple: #a371f7;
    --accent-orange: #d29922;
    --accent-red: #f85149;
    --accent-cyan: #39c5cf;
    --border-color: #30363d;
    --border-light: #21262d;
    --code-bg: #0d1117;
    --highlight-bg: #1f2937;
    --shadow: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-light: 0 4px 12px rgba(0,0,0,0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 16px;
    min-height: 100vh;
}

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

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; color: var(--accent-blue); }
h3 { font-size: 1.5rem; color: var(--accent-purple); }
h4 { font-size: 1.25rem; color: var(--accent-cyan); }
h5 { font-size: 1.1rem; }

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

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

a:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

/* Main Container */
.container {
    max-width: 100%;
    padding: 0 40px;
    margin: 0 auto;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

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

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

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

/* Module Navigation Sidebar */
.module-layout {
    display: flex;
    min-height: calc(100vh - 80px);
}

.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: block;
    padding: 10px 15px;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--accent-blue);
    color: white;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 40px 60px;
    max-width: calc(100% - 300px);
}

/* Section Styling */
.section {
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.section-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.card-icon.blue { background: rgba(88, 166, 255, 0.2); color: var(--accent-blue); }
.card-icon.green { background: rgba(63, 185, 80, 0.2); color: var(--accent-green); }
.card-icon.purple { background: rgba(163, 113, 247, 0.2); color: var(--accent-purple); }
.card-icon.orange { background: rgba(210, 153, 34, 0.2); color: var(--accent-orange); }
.card-icon.cyan { background: rgba(57, 197, 207, 0.2); color: var(--accent-cyan); }

/* Definition Box */
.definition-box {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(163, 113, 247, 0.1));
    border-left: 4px solid var(--accent-blue);
    border-radius: 0 12px 12px 0;
    padding: 20px 25px;
    margin: 20px 0;
}

.definition-box h4 {
    color: var(--accent-blue);
    margin-bottom: 10px;
}

/* Important Box */
.important-box {
    background: rgba(248, 81, 73, 0.1);
    border-left: 4px solid var(--accent-red);
    border-radius: 0 12px 12px 0;
    padding: 20px 25px;
    margin: 20px 0;
}

.important-box h4 {
    color: var(--accent-red);
    margin-bottom: 10px;
}

/* Example Box */
.example-box {
    background: rgba(63, 185, 80, 0.1);
    border-left: 4px solid var(--accent-green);
    border-radius: 0 12px 12px 0;
    padding: 20px 25px;
    margin: 20px 0;
}

.example-box h4 {
    color: var(--accent-green);
    margin-bottom: 10px;
}

/* Note Box */
.note-box {
    background: rgba(210, 153, 34, 0.1);
    border-left: 4px solid var(--accent-orange);
    border-radius: 0 12px 12px 0;
    padding: 20px 25px;
    margin: 20px 0;
}

.note-box h4 {
    color: var(--accent-orange);
    margin-bottom: 10px;
}

/* Code Blocks */
.code-block {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.code-block code {
    color: var(--text-primary);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--bg-tertiary);
    border-radius: 8px 8px 0 0;
    margin: 20px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.code-header + .code-block {
    margin-top: 0;
    border-radius: 0 0 8px 8px;
}

/* Inline Code */
code {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-cyan);
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

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

th {
    background: var(--bg-tertiary);
    color: var(--accent-blue);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

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

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

/* Lists */
ul, ol {
    margin: 15px 0;
    padding-left: 30px;
}

li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

li strong {
    color: var(--text-primary);
}

/* Nested Lists */
ul ul, ol ol, ul ol, ol ul {
    margin-top: 10px;
    margin-bottom: 0;
}

/* Diagram Container */
.diagram-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin: 25px 0;
    text-align: center;
}

.diagram-container h4 {
    margin-bottom: 20px;
    color: var(--accent-purple);
}

.diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.diagram-row {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.diagram-box {
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-blue);
    border-radius: 8px;
    padding: 15px 25px;
    min-width: 150px;
    text-align: center;
}

.diagram-box.primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    color: white;
}

.diagram-box.secondary {
    border-color: var(--accent-green);
}

.diagram-arrow {
    font-size: 1.5rem;
    color: var(--accent-blue);
}

/* Q&A Section */
.qa-section {
    margin: 30px 0;
}

.qa-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
}

.qa-question {
    padding: 20px 25px;
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.qa-question:hover {
    background: var(--highlight-bg);
}

.qa-question h4 {
    margin: 0;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

.qa-question h4::before {
    content: 'Q';
    background: var(--accent-blue);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.qa-toggle {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.qa-item.active .qa-toggle {
    transform: rotate(180deg);
}

.qa-answer {
    padding: 0 25px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.qa-item.active .qa-answer {
    padding: 25px;
    max-height: 2000px;
}

.qa-answer::before {
    content: 'A';
    background: var(--accent-green);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 10px;
    float: left;
    margin-top: 3px;
}

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

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

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

/* Feature Cards */
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-blue);
}

.feature-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.feature-card h4 {
    margin-bottom: 10px;
}

/* Comparison Table */
.comparison-table {
    margin: 20px 0;
}

.comparison-table th:first-child {
    width: 30%;
}

.comparison-table .check {
    color: var(--accent-green);
}

.comparison-table .cross {
    color: var(--accent-red);
}

/* Steps/Process */
.steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 25px 0;
}

.step {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.step-number {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    padding-top: 8px;
}

.step-content h4 {
    margin-bottom: 8px;
}

/* Tabs */
.tabs-container {
    margin: 25px 0;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

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

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Progress Indicator */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    z-index: 1001;
    transition: width 0.2s ease;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-purple);
    transform: translateY(-3px);
}

/* Index Page Specific */
.hero {
    text-align: center;
    padding: 80px 40px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 30px;
}

.hero-badge {
    display: inline-block;
    background: var(--bg-tertiary);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Module Cards for Index */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 60px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
}

.module-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-blue);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.module-card .module-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
}

.module-card h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.module-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.module-card .topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.module-card .topic-tag {
    background: var(--bg-tertiary);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

/* Syntax Highlighting for SQL */
.sql-keyword { color: var(--accent-blue); font-weight: 600; }
.sql-function { color: var(--accent-purple); }
.sql-string { color: var(--accent-green); }
.sql-number { color: var(--accent-orange); }
.sql-comment { color: var(--text-muted); font-style: italic; }
.sql-operator { color: var(--accent-cyan); }

/* ER Diagram Styles */
.er-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
}

.er-entity {
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-blue);
    padding: 15px 30px;
    border-radius: 4px;
    font-weight: 600;
}

.er-relationship {
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-green);
    padding: 15px 25px;
    transform: rotate(45deg);
    font-weight: 600;
}

.er-relationship span {
    display: block;
    transform: rotate(-45deg);
}

.er-attribute {
    background: transparent;
    border: 2px solid var(--accent-purple);
    border-radius: 50%;
    padding: 10px 20px;
    font-size: 0.9rem;
}

.er-attribute.key {
    text-decoration: underline;
}

.er-weak {
    border-style: double;
    border-width: 3px;
}

/* Schema Box */
.schema-box {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    margin: 15px 0;
    font-family: 'Consolas', monospace;
}

.schema-box .table-name {
    color: var(--accent-blue);
    font-weight: 600;
}

.schema-box .pk {
    color: var(--accent-green);
    text-decoration: underline;
}

.schema-box .fk {
    color: var(--accent-orange);
    font-style: italic;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--accent-blue);
    color: white;
}

/* Print Styles */
@media print {
    .sidebar, .header, .back-to-top, .progress-bar {
        display: none;
    }

    .main-content {
        max-width: 100%;
        padding: 20px;
    }

    body {
        background: white;
        color: black;
    }
}
