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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #FF6200 0%, #FFC107 100%);
    min-height: 100vh;
    color: #333333;
}

.header {
    background: #FFFFFF;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    position: relative;
}

.logo h1 {
    color: #FF6200;
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}

.logo-text {
    position: absolute;
    bottom: -7px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 1.5rem;
    color: #FFC107;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.plus-icon {
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.plus-icon:hover {
    transform: scale(1.1);
}

.logout-btn {
    background-color: #FF6200;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.logout-btn:hover {
    background-color: #d32f2f;
}

.login-btn {
    background-color: #FF6200;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.login-btn:hover {
    background-color: #e55500;
}

.signup-btn {
    background-color: #FF6200;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.signup-btn:hover {
    background-color: #d32f2f;
}

.user-info #user-info-logged-out {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info #auth-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dropdown Styles */
.user-dropdown-container {
    position: relative;
    display: inline-block;
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.user-dropdown-trigger:hover {
    background-color: #f0f0f0;
}

.user-dropdown-trigger.active {
    background-color: #f0f0f0;
}

.chevron-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.user-dropdown-trigger.active .chevron-icon {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #FFFFFF;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.user-dropdown-menu a:hover {
    background-color: #f0f0f0;
}

.user-dropdown-menu a:first-child {
    border-radius: 4px 4px 0 0;
}

.user-dropdown-menu a:last-child {
    border-radius: 0 0 4px 4px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

.welcome-card {
    background: #FFFFFF;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    text-align: center;
}

.welcome-card h2 {
    color: #FF6200;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.welcome-card p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
}

.meme-generator {
    background: #FFFFFF;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.meme-generator h3 {
    color: #FF6200;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.credits-info {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.credits-available {
    color: #2E7D32;
    background-color: #E8F5E8;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: inline-block;
    border: 1px solid #C8E6C9;
}

.credits-warning {
    color: #D32F2F;
    background-color: #FFEBEE;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: inline-block;
    border: 1px solid #FFCDD2;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.form-group.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

label {
    display: block;
    color: #333333;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group.checkbox-group label {
    margin-bottom: 0;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #FF6200;
    box-shadow: 0 0 0 3px rgba(255, 98, 0, 0.1);
}

.btn {
    background: #FF6200;
    color: #FFFFFF;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: #e55500;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.status.loading {
    background: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc02;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 900px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* Side-by-side panels */
.modal-panel-left {
    flex: 0 0 260px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-right: 1px solid #e0e0e0;
    justify-content: center;
}

.modal-panel-right {
    flex: 1;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.modal-panel-title {
    color: #FF6200;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.caption-input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.caption-input:focus {
    outline: none;
    border-color: #FF6200;
    box-shadow: 0 0 0 3px rgba(255, 98, 0, 0.1);
}

.modal-panel-left .url-container {
    margin-bottom: 0;
}

.modal-panel-left .url-container input {
    font-size: 0.8rem;
}

.modal-panel-left .btn {
    width: 100%;
}

.modal-panel-left .form-group {
    margin-bottom: 0;
}

/* Image container + caption overlays */
.image-container {
    position: relative;
    user-select: none;
    line-height: 0;
}

.image-container img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
}

.caption-overlay {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: Impact, 'Arial Black', sans-serif;
    font-weight: bold;
    color: white;
    -webkit-text-stroke: 2px black;
    text-shadow:
        -2px -2px 0 black, 2px -2px 0 black,
        -2px 2px 0 black, 2px 2px 0 black,
        0 -2px 0 black, 0 2px 0 black,
        -2px 0 0 black, 2px 0 0 black;
    paint-order: stroke fill;
    cursor: grab;
    font-size: clamp(1.2rem, 3.5vw, 2.4rem);
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
    pointer-events: auto;
}

.caption-overlay:active {
    cursor: grabbing;
}

.caption-top {
    top: 5%;
}

.caption-bottom {
    top: 85%;
}

.btn-download {
    background: #333;
}

.btn-download:hover {
    background: #555;
}

.btn-download-hd {
    background: #1a5276;
}

.btn-download-hd:hover {
    background: #21618c;
}

.url-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.url-container input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

.copy-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

.copy-btn:hover {
    background: #0056b3;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.toast.show {
    opacity: 1;
}

/* Main Layout with Sidebar */
.main-layout {
    display: flex;
    min-height: calc(100vh - 74px);
    /* Full height minus header */
}

.sidebar {
    width: 240px;
    background: #FFFFFF;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 2rem 0;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav li a {
    display: block;
    padding: 1rem 2rem;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar nav li a:hover {
    background-color: #f0f0f0;
}

.sidebar nav li a.active {
    background-color: #FF6200;
    color: #FFFFFF;
    font-weight: 600;
}

.content {
    flex-grow: 1;
    padding: 1.6rem 2rem 2rem 2rem;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .container {
        margin: 1rem auto;
        padding: 0 1rem;
    }

    .welcome-card,
    .meme-generator {
        padding: 1.5rem;
    }

    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 1rem 0;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .sidebar nav ul {
        display: flex;
        justify-content: center;
    }

    .sidebar nav li a {
        padding: 0.75rem 1.5rem;
    }

    .content {
        padding: 0.8rem 1rem 1rem 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .user-dropdown-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .modal-content {
        flex-direction: column-reverse;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-panel-left {
        border-right: none;
        border-top: 1px solid #e0e0e0;
        flex-basis: auto;
    }

    .caption-overlay {
        font-size: clamp(0.9rem, 3vw, 1.6rem);
    }
}