/* General Reset and Typography */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
    font-family: 'Merriweather', serif;
    margin: 0;
    font-size: 2.5em;
}

main {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 30px;
    /* Increased max-width for the two fixed-size cards (500px + 500px + 30px gap) */
    max-width: 1100px; 
    margin: 20px auto; /* Centers the main container */
    flex-grow: 1;
}

/* Card Styling - Applied to both viewer and submission cards */
.card {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

h2 {
    font-family: 'Merriweather', serif;
    color: #2980b9;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
    margin-top: 0;
}

/* ------------------------------------------- */
/* FIXED WIDTHS (Fixes jumping layout) */
/* ------------------------------------------- */

/* Quote Viewer Card */
.viewer-card {
    /* Fixed width to stop layout shifting */
    width: 500px; 
    min-width: 500px;
    flex: 0 0 auto; /* Disable flexibility */
    
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Submission Card (Share your wisdom) */
.submission-card {
    /* Fixed width to match the viewer card */
    width: 500px; 
    min-width: 500px;
    flex: 0 0 auto; /* Disable flexibility */
}

/* Input Styles */
.input-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

input[type="text"], textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1em;
}

textarea {
    resize: vertical;
}

/* Quote Display Area */
#single-quote-display {
    padding: 20px;
    text-align: center;
    min-height: 200px; /* Maintains a consistent height */
    
    margin: 20px 0; /* Vertical margin only, rely on parent for horizontal centering */
    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.quote-text {
    font-family: 'Merriweather', serif;
    font-style: italic;
    font-size: 1.5em;
    line-height: 1.5;
    margin: 0 0 15px 0;
    width: 100%; /* Use full available width of the fixed parent */
}

.quote-author {
    display: block;
    font-weight: bold;
    color: #555;
    font-size: 1.1em;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.controls button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

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

.controls button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

#quote-counter {
    font-weight: bold;
    color: #2c3e50;
}

/* Submit Button Style */
#submit-button {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s;
    width: 100%;
}

#submit-button:hover {
    background-color: #27ae60;
}

/* Message Styles */
.loading-message {
    color: #7f8c8d;
    text-align: center;
    padding: 20px;
}

.success-message {
    color: #27ae60;
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
}

/* Footer */
footer {
    text-align: center;
    padding: 15px;
    background-color: #2c3e50;
    color: #bdc3c7;
    margin-top: auto;
}

/* ------------------------------------------- */
/* RESPONSIVE ADJUSTMENTS (Stacking) */
/* ------------------------------------------- */
@media (max-width: 1060px) {
    main {
        flex-direction: column;
        align-items: center; /* Center items when stacked */
        max-width: 600px; /* Limit overall width */
    }
    /* Override fixed widths to allow cards to fill the mobile view */
    .card, .viewer-card, .submission-card {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
    }
}
