@import url('https://fonts.googleapis.com/css2?family=Fustat:wght@200;300;400;500;600;700&display=swap');

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

body {
    font-family: 'Fustat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 400;
    background: #101010 url('/static/background.webp') center center no-repeat;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #e0e0e0;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(16, 16, 16, 0.85);
    z-index: -1;
}

.container {
    background: #1a1a1a;
    border-radius: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    max-width: 600px;
    width: 100%;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

header {
    background: #0d0d0d;
    color: #e0e0e0;
    padding: 40px 30px;
    text-align: center;
    border-bottom: 1px solid #2a2a2a;
}

header .logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
}

header h1 {
    font-size: 3.5em;
    margin: 0;
    font-weight: 200;
    color: #ffffff;
    letter-spacing: 0.02em;
}

main {
    padding: 30px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-section {
    position: relative;
    will-change: height;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: #2a2a2a;
    color: #a0a0a0;
    cursor: pointer;
    border-radius: 0;
    font-size: 1em;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tab::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.tab:hover::before {
    width: 300px;
    height: 300px;
}

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

.tab.active {
    background: #404040;
    color: #ffffff;
    border: 1px solid #505050;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tab-content {
    display: none;
    will-change: opacity, transform;
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

@keyframes pageLoad {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Smooth transitions for all elements */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

button, input, textarea, select {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hardware acceleration for smooth animations */
.container,
.upload-section,
.tab,
.tab-content,
.drop-zone,
.btn,
.modal {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.drop-zone {
    border: 2px dashed #404040;
    border-radius: 0;
    padding: 60px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #0d0d0d;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #606060;
    background: #151515;
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.drop-zone svg {
    color: #a0a0a0;
    margin-bottom: 20px;
}

.drop-zone p {
    margin: 10px 0;
    color: #a0a0a0;
    font-weight: 400;
}

.file-info,
.url-info {
    font-size: 0.9em;
    color: #707070;
    margin-top: 10px;
    font-weight: 300;
}

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

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #2a2a2a;
    border-radius: 0;
    font-size: 1em;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #0d0d0d;
    color: #e0e0e0;
}

.input-group input:focus {
    outline: none;
    border-color: #505050;
    background: #151515;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.btn {
    width: 100%;
    padding: 15px;
    border: none;
    background: #404040;
    color: #ffffff;
    font-size: 1.1em;
    font-weight: 400;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::after {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    background: #505050;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

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

.btn-secondary {
    background: #2a2a2a;
}

.btn-secondary:hover {
    background: #333333;
}

.btn-copy {
    padding: 8px 15px;
    border: none;
    background: #404040;
    color: white;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-copy:hover {
    background: #505050;
}

.result,
.error,
.loading {
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

.result-content h3 {
    color: #a0a0a0;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5em;
}

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

.result-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border: 1px solid #2a2a2a;
}

.result-links {
    margin: 20px 0;
}

.link-group {
    margin-bottom: 15px;
}

.link-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #a0a0a0;
}

.link-display {
    display: flex;
    gap: 10px;
}

.link-display input {
    flex: 1;
    padding: 10px;
    border: 2px solid #2a2a2a;
    border-radius: 0;
    font-size: 0.95em;
    background: #0d0d0d;
    color: #e0e0e0;
}

.error {
    background: #2a1a1a;
    border: 2px solid #5a3030;
    border-radius: 0;
    padding: 20px;
    text-align: center;
}

.error p {
    color: #d08080;
    margin-bottom: 15px;
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #2a2a2a;
    border-top: 4px solid #606060;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    background: #0d0d0d;
    padding: 20px;
    text-align: center;
    color: #707070;
    font-size: 0.9em;
    border-top: 1px solid #2a2a2a;
}

/* History button */
.history-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 20px;
    background: #404040;
    color: #ffffff;
    border: 1px solid #505050;
    border-radius: 0;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, background 0.3s;
    z-index: 100;
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}

.history-btn:hover {
    transform: translateY(-2px);
    background: #505050;
}

.history-btn svg {
    width: 20px;
    height: 20px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 0;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 30px 20px;
    border-bottom: 2px solid #2a2a2a;
}

.modal-header h2 {
    margin: 0;
    color: #e0e0e0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: #707070;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.close-btn:hover {
    background: #2a2a2a;
    color: #e0e0e0;
}

/* Carousel */
.carousel {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.history-item {
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.history-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
    border-color: #404040;
}

.history-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid #2a2a2a;
}

.history-item-info {
    padding: 15px;
}

.history-item-url {
    font-size: 0.9em;
    color: #a0a0a0;
    font-weight: 600;
    word-break: break-all;
    margin-bottom: 10px;
}

.history-item-actions {
    display: flex;
    gap: 10px;
}

.history-item-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    background: #404040;
    color: white;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: background 0.3s;
}

.history-item-actions button:hover {
    background: #505050;
}

.history-item-actions button.delete-btn {
    background: #5a3030;
}

.history-item-actions button.delete-btn:hover {
    background: #6a4040;
}

.no-history {
    padding: 60px 30px;
    text-align: center;
    color: #707070;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }

    .drop-zone {
        padding: 40px 20px;
    }

    .carousel {
        grid-template-columns: 1fr;
    }

    .history-btn {
        bottom: 20px;
        right: 20px;
    }
}
