* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea; /* Default değer, page.php'de override edilecek */
    --text-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 40px;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Search Container */
.search-container {
    position: sticky;
    top: 0;
    background: var(--bg-color);
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 100;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

#searchInput {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    background: var(--bg-color);
    color: var(--text-color);
}

#searchInput:focus {
    border-color: var(--border-color);
}

#searchInput::placeholder {
    color: #666;
}

.search-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 10px;
}

.search-controls button {
    padding: 8px 16px;
    background: var(--border-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.search-controls button:hover {
    background: #1a7f64;
}

.search-controls {
    background: var(--bg-color);
    color: var(--text-color);
}

#matchCount {
    color: var(--text-color);
    font-size: 14px;
}

.search-controls button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#matchCount {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

header h1 {
    font-size: 28px;
    color: var(--text-color);
    margin-bottom: 10px;
}

/* Pages List (Ana Sayfa) */
.pages-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.page-link {
    text-decoration: none;
    color: inherit;
}

.page-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.page-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.page-card h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.page-slug {
    font-size: 14px;
    color: #999;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* Page Content */
#pageContent {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 30px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: hidden !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

#pageContent * {
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

/* Tüm elementler için zorunlu word-wrap */
#pageContent h1,
#pageContent h2,
#pageContent h3,
#pageContent h4,
#pageContent h5,
#pageContent h6,
#pageContent p,
#pageContent div,
#pageContent span {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: normal !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.element-heading {
    font-size: 24px;
    margin: 30px 0 15px 0;
    color: var(--primary-color);
    font-weight: 600;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    overflow-x: hidden !important;
    white-space: normal !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.element-heading:first-child {
    margin-top: 0;
}

/* Quill Editor Alignment Classes */
.ql-align-left,
.element-text .ql-align-left,
.element-heading .ql-align-left {
    text-align: left !important;
}
.ql-align-center,
.element-text .ql-align-center,
.element-heading .ql-align-center {
    text-align: center !important;
}
.ql-align-right,
.element-text .ql-align-right,
.element-heading .ql-align-right {
    text-align: right !important;
}
.ql-align-justify,
.element-text .ql-align-justify,
.element-heading .ql-align-justify {
    text-align: justify !important;
}

.element-text {
    font-size: 16px;
    margin: 20px 0;
    line-height: 1.8;
    color: var(--text-color);
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    overflow-x: hidden !important;
    white-space: normal !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.element-text pre,
.element-heading pre {
    background: #f8f8f8;
    border: 2px solid #ffeb3b;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.element-text code,
.element-heading code {
    font-family: 'Courier New', monospace;
    background: #f8f8f8;
    padding: 2px 4px;
    border-radius: 3px;
}

.element-text pre code,
.element-heading pre code {
    background: transparent;
    padding: 0;
}

.element-image {
    margin: 25px 0;
    text-align: center;
}

.element-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.element-video {
    margin: 25px 0;
    text-align: center;
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
}

.element-video video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.element-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: none;
    display: block;
}

/* Carousel Styles */
.element-media {
    margin: 15px 0;
    width: 100%;
    max-width: 100%;
}

.media-carousel-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    background: transparent;
    min-height: 200px;
    max-height: 80vh;
    height: auto;
    display: block;
}

.media-carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.media-carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.media-carousel-item.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.media-carousel-item img {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.media-carousel-item .element-video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    position: absolute;
    top: 0;
    left: 0;
    padding-bottom: 0;
}

.media-carousel-item .element-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    font-size: 18px;
    transition: background 0.3s;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.element-file {
    margin: 20px 0;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
    max-width: 100%;
}

@media (min-width: 768px) {
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        max-width: calc(4 * 200px + 3 * 15px);
    }
}

.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: var(--border-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 80px;
    text-align: center;
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.25);
    background: #1a7f64;
}

.file-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.file-label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 15ch;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-link {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

.file-link:hover {
    background: #5568d3;
}

/* Footer */
footer {
    margin-top: 40px;
    text-align: center;
}

.back-link {
    display: inline-block;
    padding: 10px 20px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: #5568d3;
}

/* Highlight (Arama sonuçları) */
.highlight {
    background: yellow;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.highlight.active {
    background: #ffeb3b;
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* Mobil Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .element-heading {
        font-size: 20px;
    }
    
    .element-text {
        font-size: 15px;
    }
    
    #pageContent {
        padding: 20px 15px;
    }
    
    .search-controls {
        flex-wrap: wrap;
    }
    
    .search-controls button {
        flex: 1;
        min-width: 100px;
    }
}

