/* Unified CSS for Madlibs Sites */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Bungee&family=Dancing+Script:wght@400;600&display=swap');

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid #404040;
    max-width: 800px;
    margin: 0 auto;
}

/* Headings */
h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.2em;
}

h2 {
    margin-bottom: 20px;
}

h3 {
    margin-bottom: 15px;
}

/* Site-specific background gradients */
.oliver-bg {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
}

.scarlett-bg {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.story-form-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.story-result-bg {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.construction-site-bg {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

/* Site-specific fonts */
.oliver-bg {
    font-family: 'Bungee', cursive;
}

.scarlett-bg {
    font-family: 'Dancing Script', cursive;
    font-size: 1.2em;
}

.oliver-theme {
    font-family: 'Bungee', cursive;
}

.scarlett-theme {
    font-family: 'Dancing Script', cursive;
    font-size: 1.3em;
}

/* Form labels and inputs inherit site-specific fonts */
.scarlett-bg label {
    font-family: 'Dancing Script', cursive;
    font-weight: 600;
    font-size: 1.1em;
}

.oliver-bg label {
    font-family: 'Bungee', cursive;
}

.scarlett-bg input {
    font-family: 'Dancing Script', cursive;
    font-weight: 400;
    font-size: 1.1em;
}

.oliver-bg input {
    font-family: 'Bungee', cursive;
}

.calculator-bg {
    background: linear-gradient(to bottom right, #1a1a1a, #2d2d2d);
    color: #e0e0e0;
    min-height: 100vh;
}

/* Site-specific theme colors */
.oliver-theme {
    color: #d35400;
}

.scarlett-theme {
    color: #d63384;
}

.calculator-theme {
    color: #ff8c42;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    font-weight: bold;
    color: #b0b0b0;
    display: block;
    margin-bottom: 8px;
    font-size: 1.1em;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #555;
    border-radius: 8px;
    font-size: 16px;
    background: #333;
    color: #e0e0e0;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #ff8c42;
}

button {
    width: 100%;
    padding: 15px;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
    background: linear-gradient(145deg, #ff8c42, #e6793a);
    touch-action: manipulation;
}

button:hover {
    background: linear-gradient(145deg, #e6793a, #d96d32);
}

.login-container {
    max-width: 500px;
    text-align: center;
}

.login-container .form-group {
    text-align: left;
}

.login-container button {
    margin-top: 10px;
    padding: 12px;
    font-size: 16px;
}

/* Navigation */
.date-navigation {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: var(--theme-color, #3498db);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 4px;
    background-color: white;
    border: 1px solid var(--theme-color, #3498db);
}

.nav-links a:hover {
    background-color: var(--theme-color, #3498db);
    color: white;
}

.nav-links .disabled {
    color: #999;
    font-weight: normal;
    padding: 8px 12px;
}

.current-date {
    font-weight: bold;
    color: var(--theme-color, #3498db);
}

.page-links a {
    color: var(--theme-color, #3498db);
    text-decoration: none;
    font-weight: bold;
    margin: 0 5px;
}

.page-links a:hover {
    text-decoration: underline;
}

.page-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.page-nav a {
    color: var(--theme-color, #3498db);
    text-decoration: none;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 2px solid var(--theme-color, #3498db);
    transition: all 0.3s ease;
}

.page-nav a:hover,
.page-nav a.active {
    background-color: var(--theme-color, #3498db);
    color: white;
}

/* Stories */
.story {
    font-size: 1.3em;
    line-height: 1.6;
    color: #2c3e50;
    margin: 30px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid var(--theme-color, #3498db);
}

.story-image {
    text-align: center;
    margin: 20px 0;
}

.story-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Stories Grid */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.story-card {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: white;
}

.story-card:hover {
    border-color: var(--theme-color, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.story-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.story-thumbnail {
    width: 100%;
    height: 150px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.story-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-content {
    padding: 15px;
}

.story-date {
    font-weight: bold;
    color: var(--theme-color, #3498db);
    font-size: 14px;
    margin-bottom: 8px;
}

.story-preview {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.no-stories {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-stories p {
    font-size: 18px;
    margin-bottom: 20px;
}

.create-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--theme-color, #3498db);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.create-button:hover {
    background-color: var(--theme-color-dark, #2980b9);
    transform: translateY(-1px);
}

/* Calendar */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-nav a {
    color: var(--theme-color, #3498db);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 4px;
    background-color: #f8f9fa;
    border: 1px solid var(--theme-color, #3498db);
}

.calendar-nav a:hover {
    background-color: var(--theme-color, #3498db);
    color: white;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.calendar-table th {
    background-color: var(--theme-color, #3498db);
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
}

.calendar-table td {
    width: 14.28%;
    height: 60px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #ddd;
    position: relative;
}

.calendar-table td.empty {
    background-color: #f8f9fa;
}

.calendar-table td.has-story {
    background-color: #e8f5e8;
    font-weight: bold;
}

.calendar-table td.has-story a {
    color: var(--theme-color, #3498db);
    text-decoration: none;
    display: block;
    width: 100%;
    height: 100%;
    line-height: 60px;
}

.calendar-table td.has-story a:hover {
    background-color: var(--theme-color, #3498db);
    color: white;
}

.calendar-table td.today {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
}

.calendar-table td.current {
    background-color: var(--theme-color, #3498db);
    color: white;
    font-weight: bold;
}

.calendar-table td.future {
    color: #ccc;
}

.legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

/* Calculator specific styles */
.summary {
    background-color: #333;
    border: 1px solid #555;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.stat {
    margin: 10px 0;
    font-size: 16px;
}

.chart {
    text-align: center;
    margin: 20px 0;
}

details {
    margin: 20px 0;
    border: 1px solid #555;
    border-radius: 10px;
    background-color: #333;
}

summary {
    padding: 15px;
    background-color: #404040;
    cursor: pointer;
    font-weight: bold;
    border-radius: 10px;
    user-select: none;
    color: #e0e0e0;
}

summary:hover {
    background-color: #4a4a4a;
}

.collapsible-content {
    padding: 15px;
    background-color: #2a2a2a;
    border-radius: 0 0 10px 10px;
}

/* Links and buttons */
.back-button {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(145deg, #ff8c42, #e6793a);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #ff8c42;
}

.back-button:hover {
    background: linear-gradient(145deg, #e6793a, #d96d32);
}

.back-link,
.logout-link {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.back-link a,
.logout-link a {
    color: var(--theme-color, #3498db);
    text-decoration: none;
    font-weight: bold;
    margin: 0 10px;
}

.back-link a:hover,
.logout-link a:hover {
    text-decoration: underline;
}

/* Error pages */
.error {
    color: #e74c3c;
}

.error-container {
    max-width: 400px;
    text-align: center;
}

.error-message {
    font-size: 1.3em;
    line-height: 1.6;
    color: #2c3e50;
    margin: 30px 0;
    padding: 20px;
    background-color: #fff3cd;
    border-radius: 10px;
    border-left: 4px solid var(--theme-color, #3498db);
}

.daily-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    color: #856404;
    font-size: 0.9em;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .date-navigation {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-links a,
    .nav-links .disabled {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .current-date {
        font-size: 14px;
    }
    
    .story {
        font-size: 1.1em;
        padding: 15px;
    }
    
    .page-nav {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .page-nav a {
        width: 100%;
        max-width: 200px;
        text-align: center;
    }
    
    .stories-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .story-card {
        margin-bottom: 10px;
    }
    
    .story-thumbnail {
        height: 120px;
    }
    
    .story-content {
        padding: 12px;
    }
    
    .calendar-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .calendar-header h2 {
        order: -1;
        margin: 0;
    }
    
    .calendar-nav {
        display: flex;
        gap: 10px;
    }
    
    .calendar-table th,
    .calendar-table td {
        padding: 8px 4px;
        font-size: 14px;
    }
    
    .calendar-table td {
        height: 45px;
    }
    
    .calendar-table td.has-story a {
        line-height: 45px;
    }
    
    .legend {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .summary {
        padding: 15px;
    }
    
    .chart img {
        max-width: 100%;
        height: auto;
    }
    
    .error-message {
        font-size: 1.1em;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    .login-container {
        padding: 20px;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="number"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    button {
        padding: 12px;
        font-size: 16px;
    }
    
    .date-navigation {
        padding: 10px;
    }
    
    .nav-links {
        gap: 5px;
    }
    
    .nav-links a,
    .nav-links .disabled {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .page-links {
        font-size: 14px;
    }
    
    .story {
        font-size: 1em;
        padding: 10px;
    }
    
    .story-image img {
        border-radius: 5px;
    }
    
    .page-nav a {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .stories-grid {
        gap: 10px;
    }
    
    .story-thumbnail {
        height: 100px;
    }
    
    .story-content {
        padding: 10px;
    }
    
    .story-date {
        font-size: 12px;
    }
    
    .story-preview {
        font-size: 12px;
    }
    
    .no-stories {
        padding: 40px 15px;
    }
    
    .no-stories p {
        font-size: 16px;
    }
    
    .create-button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .calendar-nav a {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .calendar-table th,
    .calendar-table td {
        padding: 5px 2px;
        font-size: 12px;
    }
    
    .calendar-table td {
        height: 35px;
    }
    
    .calendar-table td.has-story a {
        line-height: 35px;
    }
    
    .legend {
        font-size: 12px;
        gap: 8px;
    }
    
    .legend-color {
        width: 12px;
        height: 12px;
    }
    
    .summary {
        padding: 10px;
    }
    
    .stat {
        font-size: 14px;
    }
    
    details {
        margin: 15px 0;
    }
    
    summary {
        padding: 10px;
        font-size: 14px;
    }
    
    .collapsible-content {
        padding: 10px;
    }
    
    .error-message {
        font-size: 1em;
        padding: 12px;
    }
    
    .back-link,
    .logout-link {
        font-size: 14px;
    }
}