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

body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    line-height: 1.6;
    color: #333;
}

/* Header */
header {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Navigation */
nav {
    margin: 10px 0;
    font-size: 1.1rem;
}

nav a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: bold;
    padding: 0 5px;
}

nav a:hover {
    color: #3498db;
    text-decoration: underline;
}

nav a.active {
    color: #e74c3c;
    font-weight: bold;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    color: #ecf0f1;
    padding: 0 15px;
    display: inline-block;
}

.dropdown-trigger::after {
    content: ' ▼';
    font-size: 0.8rem;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown:hover .dropdown-trigger {
    color: #3498db;
    text-decoration: underline;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #e0e0e0;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 11;
}

.dropdown-content a {
    color: #2c3e50;
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
}

.dropdown-content a:hover {
    background-color: #d0d0d0;
    color: #2980b9;
}

/* Main Content */
main {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-height: calc(100vh - 120px); /* Avoid footer overlap */
}

/* Button Container (design-notes.html) */
.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.note-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.expand-button {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.expand-button:hover {
    background-color: #2980b9;
}

.note-content {
    display: none;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 100%;
    max-width: 860px;
    overflow-x: auto;
    margin-top: 10px;
}

.note-section.expanded .note-content {
    display: block;
}

/* AWS Notes (aws-notes.html) */
.category-row {
    margin-bottom: 2rem;
}

.category-row h2 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
    margin-bottom: 0.5rem;
}

.category-desc {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
}

.service-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.service-button {
    flex: 0 0 auto;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.service-button:hover {
    background-color: #2980b9;
}

.toggle-icon {
    margin-left: 10px;
    font-size: 1.2rem;
}

.content-area {
    clear: both;
}

.service-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 100%;
    max-width: 860px;
}

.service-content.active {
    padding: 15px;
    overflow-x: auto;
    max-height: 1000px; /* Large enough for content */
}

/* Common Styles */
h2, h3 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

ul {
    list-style-type: square;
    margin-left: 20px;
}

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

table th, table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

table th {
    background-color: #2c3e50;
    color: white;
}

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

/* Code Section */
.code-section {
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.code-title {
    background: #ecf0f1;
    padding: 8px;
    cursor: pointer;
    margin: 0;
    font-size: 1rem;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-title:hover {
    background: #dfe6e9;
}

.code-content {
    display: none;
    padding: 10px;
    overflow-x: auto;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

.code-section.active .code-content {
    display: block;
    max-height: 500px;
}

.code-section .toggle-icon::after {
    content: '+';
    font-size: 1rem;
    color: #3498db;
}

.code-section.active .toggle-icon::after {
    content: '−';
}

/* Syntax Highlighting */
pre {
    margin: 10px 0;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    background: #2d2d2d;
    color: #f8f8f2;
}

code {
    font-family: 'Courier New', Courier, monospace;
}

/* Mobile Rendering */
@media (max-width: 600px) {
    header {
        padding: 10px 15px;
        position: relative;
    }

    header h1 {
        font-size: 1.5rem;
    }

    nav {
        display: none;
        position: fixed;
        top: 50px;
        left: 0;
        width: 100%;
        background-color: #2c3e50;
        z-index: 9;
        padding: 10px 0;
    }

    nav.active {
        display: block;
    }

    nav a {
        display: block;
        margin: 5px 0;
        padding: 10px 20px;
    }

    .dropdown {
        display: block;
    }

    .dropdown-trigger {
        display: block;
        padding: 10px 20px;
    }

    .dropdown-trigger::after {
        float: right;
    }

    .dropdown-content {
        position: static;
        width: 100%;
        background-color: #34495e;
        box-shadow: none;
    }

    .dropdown-content a {
        color: #ecf0f1;
        padding: 10px 40px;
    }

    .dropdown-content a:hover {
        background-color: #3e5c76;
    }

    .hamburger {
        display: block;
        background: none;
        border: none;
        color: #ecf0f1;
        font-size: 1.5rem;
        cursor: pointer;
        position: absolute;
        top: 15px;
        right: 15px;
    }

    main {
        padding: 10px;
        margin-top: 50px; /* Space for nav */
    }

    .button-container, .service-grid {
        flex-direction: column;
    }

    .expand-button, .service-button {
        width: 100%;
    }

    .note-content, .service-content {
        max-width: 100%;
    }
}

@media (min-width: 601px) {
    .hamburger {
        display: none;
    }

    nav {
        display: block !important;
    }

    nav a {
        display: inline-block;
        margin: 0 15px;
    }
}


/* Pattern Table */
.pattern-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.pattern-table th, .pattern-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.pattern-table th {
    background-color: #2c3e50;
    color: white;
}

.pattern-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.pattern-table td[rowspan] {
    vertical-align: top;
    background-color: #ecf0f1;
}

/* Image Placeholder */
.image-placeholder {
    background-color: #ecf0f1;
    color: #666;
    padding: 20px;
    text-align: center;
    border: 1px dashed #ddd;
    margin: 10px 0;
    font-style: italic;
}

.category-section {
    margin-bottom: 20px;
}
.note-section {
    margin-left: 20px;
    border-left: 2px solid #ccc;
    padding-left: 10px;
}
.note-section .note-content {
    display: none;
}
.note-section.expanded .note-content {
    display: block;
}
