/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

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

body {
    font-family: 'VT323', monospace;
    background: linear-gradient(135deg, #2b1f3b 0%, #1a1425 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.title {
    font-family: 'Press Start 2P', cursive;
    color: #ff99cc;
    text-shadow: 2px 2px #b3668c;
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    -webkit-font-smoothing: none;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    height: 75vh;
    max-height: 650px;
}

/* Compose Section */
.compose-section {
    padding: 25px;
    border-radius: 15px;
    background-color: #4a375e;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.section-title {
    font-family: 'Press Start 2P', cursive;
    color: #ff99cc;
    text-shadow: 2px 2px #b3668c;
    margin-bottom: 20px;
    font-size: 1.2rem;
    -webkit-font-smoothing: none;
}

.input-group {
    margin-bottom: 20px;
}

.input-row {
    margin-bottom: 15px;
}

.input-row input {
    width: 100%;
    font-family: 'VT323', monospace;
    background-color: #3f3150;
    border: 2px solid #8c7ba2;
    color: #f0f0f0;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 2px 2px 0px 0px #2e243b;
    outline: none;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.input-row input:focus {
    border-color: #ff99cc;
    box-shadow: 2px 2px 0px 0px #b3668c;
}

.input-row input::placeholder {
    color: #b0a3c2;
}

.message-input-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.message-input-container textarea {
    flex-grow: 1;
    width: 100%;
    font-family: 'VT323', monospace;
    background-color: #3f3150;
    border: 2px solid #8c7ba2;
    color: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 2px 2px 0px 0px #2e243b;
    outline: none;
    resize: none;
    font-size: 1.1rem;
    line-height: 1.4;
    transition: all 0.2s;
}

.message-input-container textarea:focus {
    border-color: #ff99cc;
    box-shadow: 2px 2px 0px 0px #b3668c;
}

.message-input-container textarea::placeholder {
    color: #b0a3c2;
}

.char-counter {
    font-size: 0.9rem;
    text-align: right;
    margin-top: 5px;
    color: #b0a3c2;
}

.char-counter.warning {
    color: #ff9966;
}

.char-counter.danger {
    color: #ff6666;
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.love-letter-paper {
    background-color: #ffe0f0;
    border: 4px solid #ff66aa;
    border-radius: 15px;
    box-shadow: 6px 6px 0px 0px #cc3377;
    color: #330033;
    font-family: 'VT323', monospace;
    padding: 25px;
    position: relative;
    overflow: hidden;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.letter-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 1;
}

.letter-date {
    font-size: 1rem;
    text-align: right;
    margin-bottom: 20px;
}

.letter-to {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.letter-text {
    flex-grow: 1;
    font-size: 1.1rem;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow: hidden;
    margin-bottom: 15px;
}

.letter-from {
    margin-top: auto;
    padding-top: 15px;
    border-top: 2px dotted #ff66aa;
}

.closing {
    font-size: 1rem;
    font-style: italic;
    margin-bottom: 5px;
}

.signature {
    font-size: 1.2rem;
    font-weight: bold;
}

.heart-decoration {
    position: absolute;
    font-size: 1.5em;
    opacity: 0.6;
    animation: pulse 2s infinite alternate;
    z-index: 0;
}

.heart-top-left {
    top: 10px;
    left: 10px;
    transform: rotate(-15deg);
}

.heart-bottom-right {
    bottom: 10px;
    right: 10px;
    transform: rotate(15deg);
}

@keyframes pulse {
    from {
        transform: scale(0.9);
        opacity: 0.6;
    }
    to {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-pixel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', cursive;
    background-color: #ff66aa;
    color: #fff;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 4px 4px 0px 0px #cc3377;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.1s ease-in-out;
    -webkit-font-smoothing: none;
    font-size: 0.7rem;
    white-space: nowrap;
}

.btn-pixel:hover {
    background-color: #ff88bb;
    box-shadow: 2px 2px 0px 0px #cc3377;
    transform: translate(2px, 2px);
}

.btn-pixel:active {
    background-color: #ff4499;
    box-shadow: 0px 0px 0px 0px #cc3377;
    transform: translate(4px, 4px);
}

.btn-green {
    background-color: #4CAF50;
    box-shadow: 4px 4px 0px 0px #2e7d32;
}

.btn-green:hover {
    background-color: #66BB6A;
    box-shadow: 2px 2px 0px 0px #2e7d32;
}

.btn-green:active {
    background-color: #388E3C;
    box-shadow: 0px 0px 0px 0px #2e7d32;
}

.btn-blue {
    background-color: #2196F3;
    box-shadow: 4px 4px 0px 0px #1565c0;
}

.btn-blue:hover {
    background-color: #64B5F6;
    box-shadow: 2px 2px 0px 0px #1565c0;
}

.btn-blue:active {
    background-color: #1976D2;
    box-shadow: 0px 0px 0px 0px #1565c0;
}

.message-box {
    font-family: 'VT323', monospace;
    border: 2px solid;
    border-radius: 8px;
    box-shadow: 2px 2px 0px 0px;
    font-size: 1rem;
    margin-top: 15px;
    padding: 10px 15px;
    display: none;
}

.message-box.success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.message-box.error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.message-box.info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.pixel-border {
    border: 2px solid #ff99cc;
    box-shadow: 4px 4px 0px 0px #b3668c;
    border-image: url('data:image/svg+xml;utf8,<svg width="6" height="6" viewBox="0 0 6 6" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="2" height="2" fill="%23ff99cc"/><rect x="4" y="0" width="2" height="2" fill="%23ff99cc"/><rect x="0" y="4" width="2" height="2" fill="%23ff99cc"/><rect x="4" y="4" width="2" height="2" fill="%23ff99cc"/></svg>') 2 stretch;
}

.printable-letter-area {
    padding: 25px;
    background-color: #ffe0f0;
    border: 4px solid #ff66aa;
    box-shadow: none;
    color: #330033;
    font-family: 'VT323', monospace;
    line-height: 1.4;
    white-space: pre-wrap;
    font-size: 1.1rem;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.printable-letter-area .heart-decoration {
    position: absolute;
    font-size: 1.5em;
    opacity: 0.6;
    animation: none;
    z-index: -1;
}

/* Responsive Design */
@media (max-width: 968px) {
    .layout-grid {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
        gap: 20px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }

    
    .action-buttons .btn-pixel {
        width: 100%;
    }
}

@media (max-width: 576px) {
    body {
        padding: 15px;
    }
    
    .title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
    
    .compose-section, .love-letter-paper {
        padding: 20px;
    }
    
    .btn-pixel {
        font-size: 0.6rem;
        padding: 10px;
        min-width: 0;
        width: 100%;
    }
}