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

:root {
    --aws-orange: #FF9900;
    --aws-orange-dark: #EC7211;
    --aws-dark: #232F3E;
    --aws-gray: #545B64;
    --aws-light-gray: #EAEDED;
    --bg-white: #FFFFFF;
    --text-dark: #16191F;
    --text-gray: #545B64;
    --border-gray: #D5DBDB;
}

body {
    font-family: 'Amazon Ember', 'Helvetica Neue', Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--aws-light-gray);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: var(--bg-white);
    color: var(--aws-dark);
    padding: 40px 30px;
    text-align: center;
    border-bottom: 3px solid var(--aws-orange);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--aws-dark);
}

header h2 {
    font-size: 1.8rem;
    color: var(--aws-orange);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--aws-orange);
    font-size: 1rem;
    font-weight: 500;
}

main {
    padding: 40px 30px;
}

.info-box {
    background: linear-gradient(135deg, rgba(255, 153, 0, 0.05) 0%, rgba(255, 153, 0, 0.02) 100%);
    border-left: 4px solid var(--aws-orange);
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 32px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.info-intro {
    font-size: 1.05rem;
    color: var(--aws-dark);
    margin-bottom: 16px;
    font-weight: 500;
}

.info-list {
    list-style: none;
    padding-left: 0;
    margin: 16px 0;
}

.info-list li {
    padding: 8px 0 8px 28px;
    position: relative;
    color: var(--text-dark);
    line-height: 1.6;
}

.info-list li:before {
    content: "▶";
    position: absolute;
    left: 8px;
    color: var(--aws-orange);
    font-size: 0.7em;
}

.info-footer {
    font-size: 0.95rem;
    color: var(--aws-gray);
    margin-top: 16px;
    font-style: italic;
}

.input-section {
    margin-bottom: 30px;
}

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

label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--aws-dark);
    font-size: 1.1rem;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
    background: var(--bg-white);
    color: var(--text-dark);
}

textarea:focus {
    outline: none;
    border-color: var(--aws-orange);
    box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.1);
}

textarea:focus::placeholder {
    opacity: 0;
}

textarea::placeholder {
    color: var(--aws-gray);
}

.character-counter {
    text-align: right;
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.character-counter.normal {
    color: var(--aws-gray);
}

.character-counter.caution {
    color: var(--aws-orange);
}

.character-counter.warning {
    color: #D13212;
    font-weight: 600;
}

.submit-btn {
    width: 100%;
    padding: 18px 40px;
    background: var(--aws-orange);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: none;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.submit-btn:hover:not(:disabled) {
    background: var(--aws-orange-dark);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    transform: translateY(-1px);
}

.submit-btn:active:not(:disabled) {
    background: #DD6B10;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--aws-gray);
}

.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.output-section {
    margin-top: 40px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.output-header h3 {
    color: var(--aws-dark);
    font-size: 1.5rem;
    font-weight: 700;
}

.download-btn {
    padding: 10px 24px;
    background: white;
    color: var(--aws-dark);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.download-btn:hover {
    background: var(--aws-light-gray);
    border-color: var(--aws-gray);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.download-btn:active {
    background: var(--border-gray);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.markdown-output {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 4px;
    border: 1px solid var(--border-gray);
    line-height: 1.8;
}

.tools-container {
    margin-bottom: 20px;
}

.thinking {
    color: var(--aws-orange);
    font-size: 1.2em;
    text-align: center;
    padding: 40px;
    animation: pulse 1.5s ease-in-out infinite;
}

.tool-call {
    color: var(--aws-gray);
    font-size: 0.95em;
    padding: 12px 16px;
    background: rgba(255, 153, 0, 0.05);
    border-left: 3px solid var(--aws-orange);
    border-radius: 4px;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    animation: slideIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.markdown-output h2 {
    color: var(--aws-dark);
    font-weight: 700;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.6rem;
    border-bottom: 2px solid var(--success-color);
    padding-bottom: 8px;
}

.markdown-output h3 {
    color: var(--aws-orange);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3rem;
    font-weight: 600;
}

.markdown-output ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.markdown-output li {
    margin-bottom: 8px;
    color: var(--text-dark);
}

.markdown-output a {
    color: var(--aws-orange);
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.markdown-output a:hover {
    color: var(--aws-orange-dark);
    text-decoration: underline;
}

.markdown-output a .play-icon {
    display: inline-block;
    transition: transform 0.2s ease;
}

.markdown-output a:hover .play-icon {
    transform: scale(1.2);
}

.markdown-output p {
    margin-bottom: 15px;
    color: var(--text-dark);
}

.markdown-output strong {
    color: var(--aws-dark);
    font-weight: 600;
}

.error-section {
    margin-top: 20px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-message {
    background: #FEF0F0;
    color: #D13212;
    padding: 20px;
    border-radius: 4px;
    border-left: 4px solid #D13212;
    border: 1px solid #D13212;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.error-icon {
    font-size: 1.5rem;
}

footer {
    background: var(--primary-color);
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 30px 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header h2 {
        font-size: 1.4rem;
    }
    
    main {
        padding: 25px 20px;
    }
    
    .output-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .download-btn {
        width: 100%;
    }
    
    .markdown-output {
        padding: 20px;
    }
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--aws-gray);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-gray);
}

/* YouTube Mini Player */
.youtube-player {
    width: 100%;
    max-width: 100%;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border-gray);
}

.youtube-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--aws-dark);
    color: white;
}

.youtube-player-title {
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.youtube-player-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.youtube-player-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.youtube-player-content {
    width: 100%;
    aspect-ratio: 16/9;
    background: black;
    min-height: 300px;
}

@media (max-width: 768px) {
    .youtube-player-content {
        min-height: 200px;
    }
}
