@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

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

:root {
    --primary-blue: #87CEEB;
    --dark-blue: #4682B4;
    --light-blue: #B0E0E6;
    --bg-color: #F8FAFB;
    --white: #FFFFFF;
    --text-dark: #2C3E50;
    --border-color: #87CEEB;
    --shadow-offset: 6px;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
}

a {
    color: inherit;
    text-decoration: none;
    outline: none;
}

a:hover,
a:focus,
a:active {
    text-decoration: none;
    outline: none;
}

.container {
    background: var(--white);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary-blue);
    max-width: 600px;
    width: 90%;
    font-size: 14px;
}

.window-title {
    background: var(--primary-blue);
    color: var(--white);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    border-bottom: 1px solid var(--dark-blue);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.window-controls {
    display: flex;
    gap: 6px;
}

.window-btn {
    width: 12px;
    height: 12px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
}

.close { 
    background: #D4A5A5;
    border-color: #C19999;
}

.minimize { 
    background: #D4C5A5;
    border-color: #C1B399;
}

.maximize { 
    background: #A5D4B0;
    border-color: #99C1A5;
}

.window-content {
    padding: 32px;
}

header {
    text-align: center;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    padding: 24px;
    background: var(--bg-color);
    box-shadow: 4px 4px 0 var(--light-blue);
}

header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--dark-blue);
    font-weight: 700;
    letter-spacing: 2px;
}

header p {
    color: var(--text-dark);
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 12px;
}

.history-link {
    background: none;
    border: none;
    color: var(--dark-blue);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.history-link:hover {
    opacity: 1;
}

.url-input-section {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

#musicUrl {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--border-color);
    background: var(--white);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--text-dark);
    box-shadow: 3px 3px 0 var(--light-blue);
}

#musicUrl:focus {
    outline: none;
    border-color: var(--dark-blue);
    box-shadow: 3px 3px 0 var(--primary-blue);
}

#convertBtn {
    padding: 16px 24px;
    background: var(--primary-blue);
    border: 2px solid var(--dark-blue);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: var(--white);
    box-shadow: 4px 4px 0 var(--dark-blue);
    transition: all 0.1s ease;
}

#convertBtn:hover {
    background: var(--dark-blue);
    transform: translate(1px, 1px);
    box-shadow: 3px 3px 0 var(--dark-blue);
}

#convertBtn:active {
    transform: translate(4px, 4px);
    box-shadow: none;
}

.loading {
    text-align: center;
    padding: 32px 24px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    margin: 16px 0;
    box-shadow: 3px 3px 0 var(--light-blue);
}

.spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0 auto 20px;
    height: 40px;
}

.spinner-dot {
    width: 12px;
    height: 12px;
    background: var(--primary-blue);
    border-radius: 0;
    animation: loading-bounce 1.4s ease-in-out infinite both;
    box-shadow: 2px 2px 0 var(--dark-blue);
}

.spinner-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.spinner-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.spinner-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0) translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1) translateY(-10px);
        opacity: 1;
    }
}

.loading p {
    font-size: 14px;
    color: var(--text-dark);
    opacity: 0.8;
    margin: 0;
    animation: loading-text-pulse 2s ease-in-out infinite;
}

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

.results {
    text-align: center;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--white);
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--light-blue);
}

#albumArt {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid var(--border-color);
    box-shadow: 2px 2px 0 var(--primary-blue);
}

.track-details {
    text-align: left;
    flex: 1;
}

#trackTitle {
    font-size: 18px;
    color: var(--dark-blue);
    margin-bottom: 8px;
    font-weight: 700;
}

#artistName {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 4px;
    opacity: 0.9;
}

#albumName {
    color: var(--text-dark);
    font-size: 12px;
    opacity: 0.7;
}

.short-url-section {
    margin-bottom: 24px;
    text-align: left;
}

.short-url-container {
    background: var(--white);
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--light-blue);
    padding: 20px;
}

.short-url-container label {
    display: block;
    font-size: 12px;
    color: var(--dark-blue);
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.short-url-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

#shortUrlInput {
    flex: 1;
    padding: 12px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-dark);
    outline: none;
    box-shadow: 2px 2px 0 var(--primary-blue);
    transition: all 0.1s ease;
}

#shortUrlInput:focus {
    background: var(--white);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--primary-blue);
}

.short-url-copy {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    background: var(--white);
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0 var(--primary-blue);
}

.short-url-copy:hover {
    background: var(--bg-color);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--primary-blue);
}

.short-url-copy:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.platform-links {
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.platform-link {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: var(--white);
    border: 2px solid var(--border-color);
    transition: all 0.1s ease;
    box-shadow: 3px 3px 0 var(--light-blue);
}

.platform-link:hover {
    background: var(--bg-color);
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 var(--light-blue);
}

.platform-link:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.copy-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    position: relative;
}

.copy-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn svg {
    width: 20px;
    height: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.copy-btn .check-icon {
    stroke-width: 3;
}

.spotify-copy {
    color: var(--dark-blue);
}

.spotify-copy:hover {
    color: var(--primary-blue);
}

.apple-copy {
    color: var(--dark-blue);
}

.apple-copy:hover {
    color: var(--primary-blue);
}

.platform-link a {
    text-decoration: none;
    color: var(--text-dark);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    outline: none;
}

.platform-link a:hover,
.platform-link a:focus,
.platform-link a:active {
    text-decoration: none;
    outline: none;
    color: var(--text-dark);
}

.hidden {
    display: none !important;
}

.error {
    text-align: center;
    padding: 20px;
    color: #D32F2F;
    background: #FFEBEE;
    border: 2px solid #D32F2F;
    font-weight: 700;
    box-shadow: 4px 4px 0 #FFCDD2;
}

/* Quick Access Styles */
.quick-access {
    margin-top: 24px;
    background: var(--white);
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--light-blue);
    padding: 20px;
}

.quick-access-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.quick-access-header h3 {
    font-size: 14px;
    color: var(--dark-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.view-all-btn {
    background: none;
    border: none;
    color: var(--dark-blue);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 2px 4px;
}

.view-all-btn:hover {
    opacity: 1;
}

.quick-access-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-access-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    box-shadow: 2px 2px 0 var(--primary-blue);
    cursor: pointer;
    transition: all 0.1s ease;
    border-radius: 0;
}

.quick-access-item:hover {
    background: var(--white);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--primary-blue);
}

.quick-access-item:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.quick-access-item img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    box-shadow: 1px 1px 0 var(--primary-blue);
}

.quick-access-item-details {
    flex: 1;
    min-width: 0;
}

.quick-access-item-title {
    font-weight: 700;
    font-size: 11px;
    color: var(--dark-blue);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-access-item-artist {
    font-size: 10px;
    color: var(--text-dark);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-access-item-time {
    font-size: 9px;
    color: var(--text-dark);
    opacity: 0.6;
    white-space: nowrap;
}

/* History Styles */
.history-content {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 20px;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dark);
    opacity: 0.6;
}

.history-empty p:first-child {
    font-weight: 700;
    margin-bottom: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    box-shadow: 2px 2px 0 var(--light-blue);
    cursor: pointer;
    transition: all 0.1s ease;
}

.history-item:hover {
    background: var(--white);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--light-blue);
}

.history-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.history-item-details {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-weight: 700;
    font-size: 12px;
    color: var(--dark-blue);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-artist {
    font-size: 11px;
    color: var(--text-dark);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-date {
    font-size: 10px;
    color: var(--text-dark);
    opacity: 0.6;
    white-space: nowrap;
}

.history-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.back-btn {
    padding: 10px 16px;
    background: var(--primary-blue);
    border: 2px solid var(--dark-blue);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    color: var(--white);
    box-shadow: 2px 2px 0 var(--dark-blue);
    transition: all 0.1s ease;
    font-weight: 700;
}

.back-btn:hover {
    background: var(--dark-blue);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--dark-blue);
}

.back-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.clear-history-btn {
    padding: 10px 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-dark);
    box-shadow: 2px 2px 0 var(--light-blue);
    transition: all 0.1s ease;
}

.clear-history-btn:hover {
    background: #FFEBEE;
    border-color: #D32F2F;
    color: #D32F2F;
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #FFCDD2;
}

.clear-history-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border: 1px solid var(--dark-blue);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-blue);
}

@media (max-width: 768px) {
    .container {
        width: 85%;
        margin: 20px auto;
        --shadow-offset: 4px;
    }
    
    .window-content {
        padding: 24px 20px;
    }
    
    .window-title {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .history-actions {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
    }
    
    header {
        padding: 16px;
        margin-bottom: 24px;
    }
    
    header h1 {
        font-size: 18px;
        letter-spacing: 1px;
    }
    
    header p {
        font-size: 12px;
    }
    
    .url-input-section {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    #musicUrl {
        padding: 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    #musicUrl::placeholder {
        font-size: 14px;
    }
    
    #convertBtn {
        padding: 14px 20px;
        font-size: 16px;
        width: 100%;
    }
    
    .track-info {
        flex-direction: column;
        text-align: center;
        padding: 16px;
        gap: 16px;
    }
    
    .track-details {
        text-align: center;
    }
    
    #trackTitle {
        font-size: 16px;
    }
    
    #artistName {
        font-size: 13px;
    }
    
    #albumName {
        font-size: 11px;
    }
    
    .platform-links {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .platform-link {
        width: 100%;
        max-width: 280px;
        justify-content: space-between;
        padding: 16px 20px;
    }
    
    .platform-links .copy-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 16px !important;
    }
    
    .loading {
        padding: 20px 16px;
    }
    
    .error {
        padding: 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        width: 90%;
        margin: 15px auto;
    }
    
    .window-content {
        padding: 20px 16px;
    }
    
    header {
        padding: 12px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 16px;
    }
    
    .platform-link {
        max-width: none;
        padding: 14px 16px;
    }
    
    .platform-link a {
        font-size: 11px;
    }
    
    .quick-access {
        margin-top: 20px;
        padding: 16px;
    }
    
    .quick-access-header h3 {
        font-size: 12px;
    }
    
    .view-all-btn {
        font-size: 10px;
    }
    
    .quick-access-item {
        padding: 8px 10px;
        gap: 10px;
    }
    
    .quick-access-item img {
        width: 28px;
        height: 28px;
    }
    
    .quick-access-item-title {
        font-size: 10px;
    }
    
    .quick-access-item-artist {
        font-size: 9px;
    }
    
    .quick-access-item-time {
        font-size: 8px;
    }
}
