/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    color: #ffffff;
    overflow-x: hidden;
}

/* Card appear animation */
.card-anim {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(6px);
    transition: opacity 320ms ease, transform 420ms cubic-bezier(0.22, 1, 0.36, 1), filter 420ms ease;
    will-change: opacity, transform, filter;
}

.card-anim.in {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

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

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ffd700;
    object-fit: cover;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: #ffd700;
    margin: 0;
}

.user-username {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.balance {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 215, 0, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.balance-icon {
    font-size: 18px;
}

.balance-amount {
    font-weight: 600;
    color: #ffd700;
}

/* Main Content */
.main-content {
    padding: 20px;
}

.adsgram-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.adsgram-button {
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    background: rgba(100, 149, 237, 0.2);
    color: #ffffff;
    margin-bottom: 16px;
}

.adsgram-button:hover {
    background: rgba(100, 149, 237, 0.4);
    transform: translateY(-1px);
}

.adsgram-button:active {
    transform: translateY(0);
}

/* Tasks Section */
.tasks-section {
    margin-top: 30px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 20px;
    text-align: center;
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Task Card */
.task-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.4);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.task-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    flex: 1;
}

.task-reward {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 215, 0, 0.2);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.reward-icon {
    font-size: 14px;
}

.reward-amount {
    font-weight: 600;
    color: #ffd700;
    font-size: 14px;
}

.task-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.task-button {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(100, 149, 237, 0.6);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.task-button:hover {
    background: rgba(100, 149, 237, 0.2);
    border-color: rgba(100, 149, 237, 0.8);
    transform: translateY(-1px);
}

.task-button:active {
    transform: translateY(0);
}

/* Compact "done" button for Tgrass offers */
.task-button.small {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.task-button.done {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
    cursor: default;
}

.task-button.done:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: none;
}


/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    margin: 5% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    color: #ffd700;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 16px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1e3c72;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .tasks-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .task-card {
        padding: 16px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-weight: 500;
}

.message.info {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #2196f3;
}

.message.success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.message.error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #f44336;
}

/* Partner tasks (AdsGram) */
.partner-tasks {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 480px;
    margin: 0 auto;
}

.adsgram-task {
    --adsgram-task-font-size: 16px;
    --adsgram-task-icon-size: 36px;
    --adsgram-task-icon-title-gap: 10px;
    --adsgram-task-icon-border-radius: 12px;
    --adsgram-task-button-width: 140px;

    display: block;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(8px);
}

.task__reward {
    font-weight: 700;
    color: #ffd700;
}

.task__button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 10px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1e3c72;
    font-weight: 700;
    min-width: 140px;
}

.task__button_claim {
    background: linear-gradient(135deg, #7CFFCB 0%, #74F2CE 100%);
    color: #0e3a5d;
}

.task__button_done {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Bottom Sheet (Proof Hint) */
.sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1100;
}

.sheet-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 16px 16px 20px;
    min-height: 50vh;
    max-height: 60vh;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.35);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sheet-overlay.visible .sheet-content {
    transform: translateY(0);
}

.sheet-close-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    font-size: 18px;
    cursor: pointer;
}

.sheet-body {
    margin-top: 16px;
    padding: 8px 8px 0 8px;
}

.sheet-text {
    text-align: center;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: rgba(255,255,255,0.98);
    letter-spacing: 0.2px;
}

.sheet-footer {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 16px 12px;
}

.sheet-footer .btn {
    flex: none;
    width: 100%;
    max-width: 320px;
}

/* Upload Modal */
.upload-modal-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    margin: 5% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 520px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Center title in upload modal header */
.upload-modal-content .modal-header {
    position: relative;
    justify-content: center;
}

.upload-modal-content .modal-header h3 {
    text-align: center;
    width: 100%;
    margin: 0;
}

.upload-modal-content .modal-header .close-btn {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 14px;
    color: rgba(255,255,255,0.85);
}

input[type="file"],
textarea {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}

textarea::placeholder {
    color: rgba(255,255,255,0.6);
}

/* Custom upload control */
.hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.upload-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1e3c72;
    font-weight: 600;
    border: none;
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);
}

.upload-btn:active {
    transform: translateY(0);
}

.upload-icon {
    font-size: 18px;
}

.upload-filename {
    flex: 1;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.upload-preview {
    margin-top: 12px;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.05);
    display: none;
    overflow: hidden;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}