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

:root {
    /* Default theme colors */
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3f7;
    --background-color: #f5f5f5;
    --text-color: #333;
    --card-bg: #fff;
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    
    /* Countdown preview gradient */
    --gradient-start: #4a6fa5;
    --gradient-end: #166088;
    
    /* Animation settings */
    --animation-duration: 0.5s;
    --animation-timing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Sunset theme */
body.theme-sunset {
    --primary-color: #e94e1b;
    --secondary-color: #c83200;
    --accent-color: #ffb84d;
    --background-color: #fff0e6;
    --gradient-start: #e94e1b;
    --gradient-end: #ff9966;
}

/* Forest theme */
body.theme-forest {
    --primary-color: #2e7d32;
    --secondary-color: #1b5e20;
    --accent-color: #8bc34a;
    --background-color: #f1f8e9;
    --gradient-start: #2e7d32;
    --gradient-end: #1b5e20;
}

/* Ocean theme */
body.theme-ocean {
    --primary-color: #0277bd;
    --secondary-color: #01579b;
    --accent-color: #80deea;
    --background-color: #e1f5fe;
    --gradient-start: #0277bd;
    --gradient-end: #01579b;
}

/* Midnight theme */
body.theme-midnight {
    --primary-color: #303f9f;
    --secondary-color: #1a237e;
    --accent-color: #7986cb;
    --background-color: #e8eaf6;
    --gradient-start: #303f9f;
    --gradient-end: #1a237e;
}

/* Rainbow theme */
body.theme-rainbow {
    --primary-color: #9c27b0;
    --secondary-color: #673ab7;
    --accent-color: #ff5722;
    --background-color: #ffffff;
    --gradient-start: #ff0000;
    --gradient-end: #9400d3;
}

/* Black theme */
body.theme-black {
    --primary-color: #607d8b;
    --secondary-color: #455a64;
    --accent-color: #90a4ae;
    --background-color: #f5f5f5;
    --gradient-start: #333333;
    --gradient-end: #000000;
}

/* Brown theme */
body.theme-brown {
    --primary-color: #795548;
    --secondary-color: #5d4037;
    --accent-color: #a1887f;
    --background-color: #efebe9;
    --gradient-start: #8B4513;
    --gradient-end: #5D4037;
}

/* Green theme */
body.theme-green {
    --primary-color: #43a047;
    --secondary-color: #2e7d32;
    --accent-color: #81c784;
    --background-color: #e8f5e9;
    --gradient-start: #4CAF50;
    --gradient-end: #2E7D32;
}

/* Yellow theme */
body.theme-yellow {
    --primary-color: #fbc02d;
    --secondary-color: #ffa000;
    --accent-color: #ffecb3;
    --background-color: #fffde7;
    --gradient-start: #FFC107;
    --gradient-end: #FFA000;
}

/* Purple theme */
body.theme-purple {
    --primary-color: #9c27b0;
    --secondary-color: #6a1b9a;
    --accent-color: #ce93d8;
    --background-color: #f3e5f5;
    --gradient-start: #9C27B0;
    --gradient-end: #6A1B9A;
}

/* Coral theme */
body.theme-coral {
    --primary-color: #ff7043;
    --secondary-color: #e64a19;
    --accent-color: #ffab91;
    --background-color: #fbe9e7;
    --gradient-start: #FF7F50;
    --gradient-end: #E64A19;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 30px 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.5rem;
}

h2 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

h3 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

/* Countdown display styles */
.countdown-display {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.countdown-display:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.target-date {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 20px;
}

.countdown-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    transition: var(--transition);
}

.countdown-label {
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 500;
}

/* Display options styles */
.display-options {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
}

.option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #f0f0f0;
    color: var(--text-color);
    border: none;
    border-radius: 30px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    /* Touch optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.option-btn:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px);
}

.option-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.option-btn:active {
    transform: translateY(1px);
}

.option-btn i {
    font-size: 1rem;
}

/* Explanation box styles */
.explanation-box {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.explanation-box p {
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-line; /* Preserves line breaks for poem format */
    font-family: Georgia, serif; /* More poetic font for the poem */
}

/* Footer styles */
footer {
    text-align: center;
    padding: 20px;
    margin-top: auto;
    color: #777;
}

footer i {
    color: #ff6b6b;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 20px 0;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 20px;
    }

    .countdown-value {
        font-size: 2.8rem;
    }

    .option-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .countdown-display, 
    .display-options, 
    .explanation-box,
    .all-formats-container,
    .share-section {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 15px 0;
    }
    
    h1 {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }

    .countdown-value {
        font-size: 2.3rem;
    }
    
    .countdown-label {
        font-size: 1rem;
    }

    .countdown-display,
    .display-options,
    .explanation-box,
    .all-formats-container,
    .share-section {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
    }

    .option-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .buttons-container {
        justify-content: center;
        gap: 8px;
    }
    
    .target-date {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    footer {
        padding: 15px;
        font-size: 0.9rem;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    body {
        padding: 10px 0;
    }
    
    h1 {
        font-size: 1.4rem;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .countdown-value {
        font-size: 2rem;
    }
    
    .countdown-display,
    .display-options,
    .explanation-box,
    .all-formats-container,
    .share-section {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .option-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .option-btn i {
        font-size: 0.9rem;
    }
}

/* All formats display */
.all-formats-container {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.format-card {
    background-color: #f8f8f8;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    /* Touch optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.format-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

@media (hover: hover) {
    .format-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }
}

/* Touch device specific styles */
@media (hover: none) {
    .format-card:active {
        transform: scale(0.98);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
}

.format-name {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.format-name i {
    color: var(--accent-color);
}

.format-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.format-label {
    color: #666;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .formats-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .formats-grid {
        grid-template-columns: 1fr;
    }
    
    .format-card {
        padding: 15px;
    }
    
    .format-value {
        font-size: 1.5rem;
    }
}

/* Share section styles */
.share-section {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    text-align: center;
}

.share-section h2 {
    margin-bottom: 10px;
}

.share-section p {
    color: #666;
    margin-bottom: 20px;
}

.preview-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.share-preview {
    width: 600px;
    max-width: 100%;
    height: auto;
    min-height: 315px;
    background: linear-gradient(135deg, #4a6fa5 0%, #166088 100%);
    border-radius: 12px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    position: relative;
}

.preview-header {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.preview-value {
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 5px;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.preview-label {
    font-size: 1.4rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* Share preview poem styling */
.preview-poem {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-line;
    text-align: center;
    max-width: 90%;
    margin: 0 auto;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.days-count {
    position: absolute;
    bottom: 15px;
    left: 15px;
    font-size: 0.9rem;
    color: var(--accent-color);
    background-color: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--accent-color);
    text-shadow: none;
}

.preview-all-formats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    text-align: left;
}

.preview-format-item {
    background-color: rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: bold;
}

.preview-poem-columns {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    text-align: left;
}

.preview-poem-column {
    flex: 1;
    min-width: 45%;
}

.preview-poem-single {
    margin-top: 15px;
    text-align: left;
}

.preview-poem-language {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--accent-color);
    font-size: 0.95rem;
}

.preview-poem-content {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    line-height: 1.7;
    white-space: pre-line;
    font-size: 0.85rem;
}

/* Removed preview-footer */

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 15px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #f0f0f0;
    color: var(--text-color);
    border: none;
    border-radius: 30px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    /* Touch optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    outline: none;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-btn:active {
    transform: translateY(1px);
}

.download-btn {
    background-color: #4CAF50;
    color: white;
}

.twitter-btn {
    background-color: #1DA1F2;
    color: white;
}

.facebook-btn {
    background-color: #4267B2;
    color: white;
}

.download-btn:hover {
    background-color: #43A047;
}

.twitter-btn:hover {
    background-color: #1A91DA;
}

.facebook-btn:hover {
    background-color: #365899;
}

.download-btn.disabled,
.share-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.image-generator-status {
    min-height: 40px;
    font-size: 0.95rem;
    color: #666;
    margin-top: 10px;
}

/* Responsive styles for share section */
@media (max-width: 768px) {
    .share-preview {
        min-height: 250px;
        padding: 25px;
    }
    
    .preview-container {
        margin-bottom: 20px;
    }
    
    .preview-header {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    .preview-value {
        font-size: 3.2rem;
    }
    
    .preview-label {
        font-size: 1.2rem;
    }
    
    .share-btn {
        padding: 10px 18px;
        font-size: 0.95rem;
    }
    
    .image-generator-status {
        min-height: 30px;
    }
}

@media (max-width: 480px) {
    .share-section h2 {
        font-size: 1.3rem;
    }
    
    .share-section p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .share-preview {
        min-height: 200px;
        border-radius: 8px;
        padding: 20px;
    }
    
    .preview-header {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .preview-value {
        font-size: 2.2rem;
    }
    
    .preview-label {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .preview-poem {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .share-buttons {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .share-btn {
        width: 100%;
        padding: 10px 15px;
        font-size: 0.9rem;
        border-radius: 25px;
    }
    
    .image-generator-status {
        min-height: 20px;
        font-size: 0.85rem;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    .share-preview {
        min-height: 180px;
        padding: 15px;
    }
    
    .preview-header {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .preview-value {
        font-size: 1.8rem;
    }
    
    .preview-label {
        font-size: 0.8rem;
    }
    
    .preview-poem {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .share-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* Poem specific styling */
.poem-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin: 20px 0;
    justify-content: space-between;
}

.poem-column {
    flex: 1;
    min-width: 250px;
}

.poem-language {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.poem-content {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    line-height: 1.8;
    white-space: pre-line;
}

/* Language toggle controls */
#poem-language-controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 8px;
    text-align: center;
}

#poem-language-controls h4 {
    margin-bottom: 10px;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.language-toggle-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.language-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 8px 15px;
    border-radius: 20px;
    transition: all 0.2s ease;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.language-toggle:hover {
    background-color: #e8f4ff;
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}

.language-toggle input {
    margin-right: 5px;
}

.language-toggle input:checked + span {
    font-weight: bold;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .poem-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .poem-column {
        min-width: 100%;
    }
}

/* Menu bar */
.menu-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.menu-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.menu-btn:hover {
    background-color: var(--secondary-color);
}

.menu-btn i {
    font-size: 16px;
}

/* Color theme selector */
.color-theme-selector {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
}

.theme-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px;
    border-radius: 8px;
}

.theme-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-3px);
}

.theme-btn.active {
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.theme-preview {
    width: 60px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.default-theme {
    background: linear-gradient(135deg, #4a6fa5 0%, #166088 100%);
}

.sunset-theme {
    background: linear-gradient(135deg, #e94e1b 0%, #ff9966 100%);
}

.forest-theme {
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
}

.ocean-theme {
    background: linear-gradient(135deg, #0277bd 0%, #01579b 100%);
}

.midnight-theme {
    background: linear-gradient(135deg, #303f9f 0%, #1a237e 100%);
}

.rainbow-theme {
    background: linear-gradient(135deg, #ff0000 0%, #ff7f00 15%, #ffff00 30%, #00ff00 45%, #0000ff 60%, #4b0082 75%, #9400d3 100%);
}

.black-theme {
    background: linear-gradient(135deg, #333333 0%, #000000 100%);
}

.brown-theme {
    background: linear-gradient(135deg, #8B4513 0%, #5D4037 100%);
}

.green-theme {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
}

.yellow-theme {
    background: linear-gradient(135deg, #FFC107 0%, #FFA000 100%);
}

.purple-theme {
    background: linear-gradient(135deg, #9C27B0 0%, #6A1B9A 100%);
}

.coral-theme {
    background: linear-gradient(135deg, #FF7F50 0%, #E64A19 100%);
}

/* Update share-preview to use theme colors */
.share-preview {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
}

/* Animation for value change */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Format transition animations */
.format-transition-enter {
    animation: var(--animation-duration) var(--animation-timing) formatEnter;
}

.format-transition-exit {
    animation: var(--animation-duration) var(--animation-timing) formatExit;
}

@keyframes formatEnter {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes formatExit {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

@keyframes slideRight {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideLeft {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Apply animations */
.animate-value {
    animation: fadeIn var(--animation-duration) var(--animation-timing) forwards;
}

.animate-slide-right {
    animation: slideRight var(--animation-duration) var(--animation-timing) forwards;
}

.animate-slide-left {
    animation: slideLeft var(--animation-duration) var(--animation-timing) forwards;
}

.animate-zoom {
    animation: zoomIn var(--animation-duration) var(--animation-timing) forwards;
}

.animate-bounce {
    animation: bounce var(--animation-duration) cubic-bezier(0.215, 0.610, 0.355, 1.000) forwards;
}
