/* ============================================
   ITU Style Guide - Contemporary Tech (ITU Blue Edition)
   With Dark Mode Support
   ============================================ */

/* CSS Variables for Light and Dark Themes */
:root {
    /* Light Mode Colors */
    --primary: #0077c8;
    --primary-dark: #005a9c;
    --secondary: #10b981;
    --accent: #00a0e3;
    --light: #f8fafc;

    /* Light Mode - Background & Text */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #334155;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(0, 119, 200, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 119, 200, 0.12);
    --shadow-lg: 0 20px 40px rgba(0, 119, 200, 0.15);
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --primary: #00a0e3;
    --primary-dark: #0077c8;
    --accent: #00c8ff;

    /* Dark Mode - Background & Text */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e0;
    --text-muted: #94a3b8;

    /* Dark Mode - Borders & Shadows */
    --border-color: #334155;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    text-align: justify;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 119, 200, 0.25);
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
}

.logo a {
    color: white;
    text-decoration: none;
}

.logo img {
    padding-top: 10px;
    height: 60px;
    padding-right: 20px;
}

/* Dark Mode Toggle Button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.theme-icon {
    font-size: 1.1rem;
}

/* Container Layout */
.container {
    display: flex;
    margin-top: 70px;
    min-height: calc(100vh - 70px);
}

/* Sidebar */
aside {
    width: 280px;
    background: var(--bg-secondary);
    padding: 2rem 0;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    transition: background-color 0.3s ease;
}

aside::-webkit-scrollbar {
    width: 6px;
}

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

nav ul {
    list-style: none;
    padding: 0 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    padding: 0 1rem;
    margin-bottom: 0.75rem;
}

.chapter-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.925rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chapter-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
    transition: height 0.2s ease;
}

.chapter-link:hover {
    background: var(--bg-card);
    color: var(--primary);
}

.chapter-link:hover::before {
    height: 60%;
}

.chapter-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

.chapter-link.active::before {
    height: 0;
}

.chapter-number {
    font-weight: 600;
    font-size: 0.85rem;
    margin-right: 0.625rem;
    opacity: 0.8;
}

/* Main Content */
main {
    flex: 1;
    padding: 3rem 4rem;
    max-width: 1200px;
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    text-align: center;
}

h2 {
    font-size: 1.6rem;
    margin: 2rem 0 0.75rem;
    color: var(--primary-dark);
    font-weight: 700;
    border-bottom: 2px solid rgba(0, 119, 200, 0.2);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: justify;
}

p strong {
    color: var(--primary-dark);
    font-weight: 600;
}

p a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

p a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.intro-text {
    font-size: 1.0rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2rem;
    text-align: justify;
    font-weight: 500;
}

/* Chapter Grid (Home Page) */
.chapter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 3rem;
}

/* Chapter Cards */
.chapter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.chapter-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.chapter-card:hover::before {
    transform: scaleX(1);
}

.chapter-card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chapter-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.chapter-card p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.6;
    text-align: justify;
}

/* Buttons */
.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    font-size: 0.925rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.read-more:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.read-more svg {
    transition: transform 0.3s ease;
}

.read-more:hover svg {
    transform: translateX(4px);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, rgba(0, 119, 200, 0.1) 0%, rgba(0, 160, 227, 0.1) 100%);
    color: var(--primary-dark);
    border: 1px solid rgba(0, 119, 200, 0.2);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

/* Chapter Section */
.chapter-section {
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    transition: background-color 0.3s ease;
}

/* Example Box */
.example-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.example-tpu {
    background: var(--bg-card);
    border: 1px solid var(--secondary);
    border-left: 3px solid var(--secondary);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

/* Side-by-side Example Boxes */
.example-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.example-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.example-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.example-label {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.example-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.example-card ul p {
    margin-bottom: 0.5rem;
}

/* Copyright */
.copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Justified Text */
.justified-text {
    text-align: justify;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.data-table thead th {
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table td {
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.data-table td:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 968px) {
    .container {
        flex-direction: column;
    }

    aside {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    main {
        padding: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    header {
        flex-wrap: wrap;
        height: auto;
        padding: 1rem;
    }

    .theme-toggle {
        margin-top: 0.5rem;
    }

    /* Stack example boxes on tablet */
    .example-comparison {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    main {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .logo img {
        height: 50px;
        padding-right: 10px;
    }

    /* Responsive tables for mobile */
    .data-table {
        font-size: 0.85rem;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.5rem;
    }

    .data-table td {
        display: block;
        text-align: left;
        padding: 0.5rem;
        border-bottom: 1px solid var(--border-color);
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--primary);
        display: block;
        margin-bottom: 0.25rem;
    }
}

/* Print Styles */
@media print {
    .theme-toggle {
        display: none;
    }

    header {
        position: relative;
        box-shadow: none;
    }

    aside {
        display: none;
    }

    main {
        padding: 1rem;
    }
}
