/* styles.css */

@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Caveat&display=swap');

body {
    font-family: 'Special Elite', cursive;
    margin: 0;
    padding: 0;
    background-color: #f0e6d2;
    color: #333;
    line-height: 1.6;
}

/* Dice Roll Styles */
.dice-roll-section {
    margin: 15px 0;
    padding: 10px;
    background-color: #f5f0e5;
    border: 1px solid #d3c3a3;
    border-radius: 5px;
}

.dice-roll-section h4 {
    margin-top: 0;
    color: #6b4f2e;
}

.dice-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.dice-controls input[type="text"] {
    padding: 5px 10px;
    border: 1px solid #d3c3a3;
    background-color: #fff;
    font-family: 'Special Elite', cursive;
}

.dice-controls input#diceNotation {
    width: 120px;
}

.dice-controls input#rollPurpose {
    flex: 1;
    min-width: 200px;
}

#rollDiceBtn {
    padding: 5px 15px;
    background-color: #6b4f2e;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Special Elite', cursive;
    font-size: 16px;
}

#rollDiceBtn:hover {
    background-color: #8b6b43;
}

.dice-result {
    margin-top: 10px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #d3c3a3;
    border-radius: 3px;
    font-weight: bold;
}

.dice-result.success {
    border-color: #4CAF50;
    background-color: #f1f8f1;
}

.dice-result.failure {
    border-color: #f44336;
    background-color: #fef1f1;
}

/* Dice roll display in posts */
.post-dice-roll {
    margin: 10px 0;
    padding: 8px;
    background-color: #f5f0e5;
    border-left: 3px solid #6b4f2e;
    font-family: monospace;
}

.post-dice-roll .dice-notation {
    font-weight: bold;
    color: #6b4f2e;
}

.post-dice-roll .dice-total {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c5aa0;
}

/* Image Generation Styles */
#imageGenerationSection {
    margin-top: 20px;
    padding: 15px;
    background-color: #f5f0e5;
    border: 1px solid #d3c3a3;
    border-radius: 5px;
}

.image-generation-form {
    margin-top: 10px;
}

#imagePrompt {
    width: 100%;
    padding: 8px;
    border: 1px solid #d3c3a3;
    background-color: #fff;
    font-family: 'Special Elite', cursive;
    resize: vertical;
}

.image-options {
    margin: 10px 0;
}

#imageStyle {
    padding: 5px 10px;
    border: 1px solid #d3c3a3;
    background-color: #fff;
    font-family: 'Special Elite', cursive;
}

#generateImageBtn {
    padding: 8px 20px;
    background-color: #8b6b43;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Special Elite', cursive;
    font-size: 16px;
}

#generateImageBtn:hover {
    background-color: #6b4f2e;
}

#generateImageBtn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#imageGenerationStatus {
    margin-top: 10px;
    padding: 10px;
    border-radius: 3px;
}

#imageGenerationStatus.loading {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

#imageGenerationStatus.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

#imageGenerationStatus.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

#generatedImagePreview {
    margin-top: 15px;
    text-align: center;
}

#generatedImagePreview img {
    max-width: 100%;
    max-height: 400px;
    border: 1px solid #d3c3a3;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Post images display */
.post-images {
    margin: 15px 0;
}

.post-image-container {
    margin: 10px 0;
    text-align: center;
}

.post-image-container img {
    max-width: 100%;
    max-height: 500px;
    border: 1px solid #d3c3a3;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.2s;
}

.post-image-container img:hover {
    transform: scale(1.02);
}

.post-image-prompt {
    margin-top: 5px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

header {
    background-color: #d9c7a7;
    color: #333;
    padding: 15px;
    border-bottom: 1px solid #b0a080;
}

h1, h2, h3 {
    color: #4a4a4a;
}

nav a {
    color: #6b4f2e;
    margin: 0 10px;
    text-decoration: none;
    font-weight: bold;
}

nav a:hover {
    text-decoration: underline;
    color: #8b6b43;
}

.container {
    padding: 20px;
    max-width: 800px;
    margin: 20px auto;
}

.paper {
    background-color: #fff;
    border: 1px solid #d3c3a3;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 30px 30px 30px 110px; /* Increased left padding */
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(90deg, transparent 79px, #e1f3f5 79px, #e1f3f5 81px, transparent 81px),
        linear-gradient(#eee .1em, transparent .1em);
    background-size: 100% 1.2em;
    pointer-events: none;
    z-index: -1;
}

.paper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 80px; /* Position of the vertical line */
    bottom: 0;
    width: 1px;
    background-color: #ff9999; /* Light red color for the vertical line */
    z-index: 1;
}

.paper > * {
    position: relative;
    z-index: 2;
    padding: 30px 30px 30px 120px; /* Increased left padding */
}

/* Adjust handwritten notes to align with the new margin */
.handwritten {
    font-family: 'Caveat', cursive;
    color: #5f5f5f;
    font-size: 1.2em;
    transform: rotate(-2deg);
    margin-left: -70px; /* Pull handwritten notes into the margin */
    position: relative;
    display: block; /* Ensure it's on its own line */
    padding-left: 20px; /* Add some padding to avoid overlapping with the vertical line */
}

.handwritten::before {
    content: '✎';
    position: absolute;
    left: 0;
    top: 0;
}

/* New crazytext style */
.crazytext {
    font-family: 'Permanent Marker', cursive;
    color: #ff4500; /* Bright red-orange color */
    font-size: 1em;
    transform: rotate(-20deg);
    position: absolute;
    left: -100px; /* Position in the margin */
    width: 60px; /* Limit width to fit in margin */
    text-align: right;
    line-height: 1.2;
    padding-right: 10px;
    z-index: 3; /* Ensure it's above other content */
}

.crazytext::before {
    content: '×';
    position: relative;
    left: 0;
    top: 0;
}

.crazytext::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 2px;
    background: #ff4500;
    transform: scaleX(0.7) rotate(-5deg);
}

input[type="text"], input[type="password"], input[type="email"], textarea {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    background-color: #fff;
    border: 1px solid #b0a080;
    color: #333;
    font-family: 'Special Elite', cursive;
}

button {
    padding: 10px 15px;
    background-color: #d9c7a7;
    color: #4a4a4a;
    border: 1px solid #b0a080;
    cursor: pointer;
    font-family: 'Special Elite', cursive;
    font-weight: bold;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #c1ae8e;
}

label {
    display: block;
    margin-top: 10px;
    color: #4a4a4a;
}

#gameList ul {
    list-style-type: none;
    padding: 0;
}

#gameList li {
    padding: 5px 0;
    border-bottom: 1px dashed #b0a080;
}

form {
    background-color: #fff;
    padding: 20px;
    border: 1px solid #d3c3a3;
    margin-top: 20px;
}

.handwritten {
    font-family: 'Caveat', cursive;
    color: #5f5f5f;
    font-size: 1.2em;
    transform: rotate(-2deg);
    margin-left: 20px;
    position: relative;
}

.handwritten::before {
    content: '✎';
    position: absolute;
    left: -20px;
    top: 0;
}

.post {
    border: 1px solid #d3c3a3;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post h3 {
    margin-top: 0;
    color: #4a4a4a;
}

.post-header {
    margin-bottom: 10px;
    border-bottom: 1px solid #d3c3a3;
    padding-bottom: 5px;
}

.post-author, .post-date {
    font-size: 0.85em;
    color: #666;
    margin-right: 10px;
}

.post-content {
    white-space: pre-wrap;
}

/* GM Post styles */
.post.gm-post {
    border: 2px solid #8b4513;
    background-color: #fff3e0;
    position: relative;
    padding-left: 25px;
}

.post.gm-post::before {
    content: "GM";
    position: absolute;
    left: -10px;
    top: 10px;
    background-color: #8b4513;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8em;
}

.post.gm-post h3 {
    color: #8b4513;
    font-weight: bold;
}

.post.gm-post .post-header {
    border-bottom-color: #8b4513;
}

/* Player Post styles */
.post.player-post {
    margin-left: 40px;
    background-color: #f5f5f5;
    border-color: #666;
    border-width: 1px;
}

.post.player-post h3 {
    color: #333;
    font-weight: normal;
}

/* Post type indicator */
.post-type {
    font-size: 0.8em;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 5px;
}

.post-type.gm {
    background-color: #d9c7a7;
    color: #4a4a4a;
}

.post-type.player {
    background-color: #e8e5d5;
}

/* Doodle Canvas Styles */
.doodle-section {
    margin: 15px 0;
    padding: 15px;
    background-color: #f5f0e5;
    border: 1px solid #d3c3a3;
    border-radius: 5px;
}

.doodle-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #6b4f2e;
}

#doodleCanvas {
    display: block;
    margin: 0 auto 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    touch-action: none; /* Prevent scrolling while drawing on mobile */
    max-width: 100%;
    height: auto; /* Maintain aspect ratio on smaller screens */
}

.canvas-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.canvas-controls button {
    padding: 5px 15px;
    font-size: 14px;
}

.canvas-controls input[type="color"] {
    width: 40px;
    height: 30px;
    border: 1px solid #d3c3a3;
    cursor: pointer;
}

.canvas-controls input[type="range"] {
    width: 100px;
}

#brushSizeDisplay {
    font-size: 14px;
    color: #666;
}

/* Image Generation Styles */
.image-generation-form {
    background-color: #fff;
    padding: 20px;
    border: 1px solid #d3c3a3;
    border-radius: 5px;
}

.image-generation-form textarea {
    min-height: 80px;
    resize: vertical;
}

.image-generation-form .image-options {
    margin: 15px 0;
}

.image-generation-form select {
    width: 100%;
    padding: 8px;
    border: 1px solid #d3c3a3;
    background-color: #fff;
    font-family: 'Special Elite', cursive;
}

#imageGenerationStatus {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

#imageGenerationStatus.loading {
    background-color: #e3f2fd;
    color: #1976d2;
}

#imageGenerationStatus.success {
    background-color: #e8f5e9;
    color: #388e3c;
}

#imageGenerationStatus.error {
    background-color: #ffebee;
    color: #d32f2f;
}

#generatedImagePreview {
    margin-top: 15px;
    text-align: center;
}

#generatedImagePreview img {
    max-width: 100%;
    height: auto;
    border: 1px solid #d3c3a3;
    cursor: pointer;
    transition: transform 0.2s;
}

#generatedImagePreview img:hover {
    transform: scale(1.05);
}

.post-image-prompt {
    font-style: italic;
    color: #666;
    margin-top: 5px;
    font-size: 0.9em;
    color: #4a4a4a;
}

@media (max-width: 600px) {
    .paper {
        padding: 20px 20px 20px 100px; /* Adjust padding for smaller screens */
    }
    
    .paper::after {
        left: 60px; /* Adjust vertical line position for smaller screens */
    }
    
    .handwritten {
        margin-left: -50px; /* Adjust for smaller screens */
    }
    .container {
        padding: 10px;
    }

    .crazytext {
        left: -60px; /* Adjust position for smaller screens */
        width: 50px;
        font-size: 0.9em;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="email"],
    textarea,
    button {
        font-size: 16px;
    }
}

/* Storyboard specific styles */
.game-section {
    margin: 30px 0;
    border-bottom: 2px solid #d3c3a3;
    padding-bottom: 20px;
}

.game-section:last-child {
    border-bottom: none;
}

.game-description {
    font-style: italic;
    margin: 10px 0;
    color: #666;
}

.chapter-entry {
    margin: 20px 0;
    padding: 15px;
    background-color: #fafaf0;
    border: 1px solid #e0d0b0;
    border-radius: 5px;
}

.chapter-description {
    font-style: italic;
    margin: 10px 0;
    color: #666;
}

.chapter-narrative {
    margin: 20px 0;
    padding: 15px;
    background-color: #fff;
    border-left: 3px solid #d3c3a3;
}

.chapter-narrative h5 {
    color: #6b4f2e;
    margin: 15px 0 10px 0;
}

.chapter-narrative hr {
    border: none;
    border-top: 1px solid #d3c3a3;
    margin: 20px 0;
}

.archive-date {
    font-size: 0.9em;
    color: #888;
    text-align: right;
    margin-top: 10px;
}

/* Image Generation Styles */
.image-generation-form {
    margin-top: 20px;
    padding: 15px;
    background-color: #f5f0e5;
    border: 1px solid #d3c3a3;
    border-radius: 5px;
}

.image-generation-form textarea {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    border: 1px solid #d3c3a3;
    background-color: #fff;
    font-family: 'Special Elite', cursive;
    font-size: 14px;
    resize: vertical;
}

.image-options {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.image-options select {
    padding: 8px 12px;
    border: 1px solid #d3c3a3;
    background-color: #fff;
    font-family: 'Special Elite', cursive;
    font-size: 14px;
    cursor: pointer;
    flex: 1;
    min-width: 150px;
}

.image-options select:hover {
    border-color: #8b6f47;
}

#generateImageBtn {
    background-color: #8b6f47;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-family: 'Special Elite', cursive;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#generateImageBtn:hover:not(:disabled) {
    background-color: #6b4f2e;
}

#generateImageBtn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#imageGenerationStatus {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

#imageGenerationStatus.loading {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

#imageGenerationStatus.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#imageGenerationStatus.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#generatedImagePreview {
    margin-top: 15px;
    text-align: center;
}

#generatedImagePreview img {
    max-width: 100%;
    height: auto;
    border: 2px solid #d3c3a3;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.3s;
}

#generatedImagePreview img:hover {
    transform: scale(1.05);
}

.post-images {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.post-image-container {
    text-align: center;
}

.post-image-container img {
    width: 100%;
    height: auto;
    border: 2px solid #d3c3a3;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.3s;
}

.post-image-container img:hover {
    transform: scale(1.05);
}

.post-image-prompt {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}