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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    padding: 20px;
    min-height: 100vh;
    transition: background 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(180deg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: #764ba2;
    transform: translateX(-5px);
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.content {
    padding: 40px;
}

.section {
    margin-bottom: 40px;
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
    font-size: 1.8em;
    transition: color 0.3s ease, border-color 0.3s ease;
}

h3 {
    color: #764ba2;
    margin: 25px 0 15px 0;
    font-size: 1.4em;
    transition: color 0.3s ease;
}

h4 {
    color: #555;
    margin: 20px 0 10px 0;
    font-size: 1.1em;
    transition: color 0.3s ease;
}

/* Code blocks with Prism.js */
pre {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #2d2d2d !important;
}

pre[class*="language-"] {
    margin: 15px 0;
    padding: 0;
    border-radius: 8px;
    overflow-x: auto;
    background: #2d2d2d;
}

code[class*="language-"],
pre[class*="language-"] {
    color: #f8f8f2;
    background: none;
    text-shadow: 0 1px rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.95em;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.5;
    tab-size: 4;
    hyphens: none;
}

pre[class*="language-"] > code {
    display: block;
    padding: 20px;
    overflow-x: auto;
}

/* Inline code */
code:not([class*="language-"]) {
    font-family: 'Courier New', monospace;
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    color: #d63384;
}

.inline-code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    color: #d63384;
    font-family: 'Courier New', monospace;
}

.info-box {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.warning-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.success-box {
    background: #d4edda;
    border-left: 4px solid #28a745;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

ul, ol {
    margin: 15px 0 15px 30px;
}

li {
    margin: 8px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
}

th, td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
    transition: border-color 0.3s ease;
}

th {
    background: #667eea;
    color: white;
    font-weight: bold;
}

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

.demo-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    transition: background 0.3s ease;
}

.demo-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.demo-image-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.demo-image-card img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 10px;
}

.demo-image-card p {
    font-size: 0.9em;
    color: #666;
    margin: 5px 0;
}

.params-table {
    font-size: 0.9em;
}

footer {
    background: #2d2d2d;
    color: white;
    padding: 20px;
    text-align: center;
    transition: background 0.3s ease;
}

/* Dark Mode Styles */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-mode .container {
    background: #0f3460;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body.dark-mode .back-link {
    color: #e94560;
}

body.dark-mode .back-link:hover {
    color: #f39c12;
}

body.dark-mode header {
    background: linear-gradient(135deg, #e94560 0%, #f39c12 100%);
}

body.dark-mode .content {
    color: #e0e0e0;
}

body.dark-mode h2 {
    color: #e94560;
    border-bottom-color: #e94560;
}

body.dark-mode h3 {
    color: #f39c12;
}

body.dark-mode h4 {
    color: #bbb;
}

body.dark-mode p,
body.dark-mode li {
    color: #e0e0e0;
}

body.dark-mode .inline-code,
body.dark-mode code:not([class*="language-"]) {
    background: #1a1a2e;
    color: #f39c12;
}

body.dark-mode pre,
body.dark-mode pre[class*="language-"] {
    background: #1a1a2e !important;
}

body.dark-mode .info-box {
    background: #1e3a5f;
    border-left-color: #4a90e2;
    color: #e0e0e0;
}

body.dark-mode .warning-box {
    background: #3d3520;
    border-left-color: #f39c12;
    color: #e0e0e0;
}

body.dark-mode .success-box {
    background: #1e3d2f;
    border-left-color: #4caf50;
    color: #e0e0e0;
}

body.dark-mode table {
    background: #16213e;
}

body.dark-mode th {
    background: #e94560;
}

body.dark-mode td {
    color: #e0e0e0;
    border-color: #2d3e5f;
}

body.dark-mode tr:nth-child(even) {
    background: #1a2744;
}

body.dark-mode .demo-section {
    background: #16213e;
}

body.dark-mode .demo-image-card {
    background: #1a2744;
}

body.dark-mode .demo-image-card p {
    color: #bbb;
}

body.dark-mode footer {
    background: #0a0e1a;
}

body.dark-mode .theme-toggle {
    background: #0f3460;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

body.dark-mode .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-180deg);
}

body.dark-mode .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .content {
        padding: 20px;
    }

    .demo-images {
        grid-template-columns: 1fr;
    }
}
