/* ===== Base Styles ===== */
.social-note-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #fafafa;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ===== Step Transitions ===== */
.social-note-step {
    display: none;
    animation: fadeInUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.social-note-step.active {
    display: block;
}

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

/* ===== Form Styles ===== */
.social-note-step h2 {
    color: #262626;
    font-size: 1.75rem;
    margin-bottom: 1.75rem;
    text-align: center;
    font-weight: 600;
    background: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #262626;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #dbdbdb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.25s ease;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.form-control:focus {
    border-color: #a8a8a8;
    outline: none;
    box-shadow: 0 0 0 2px rgba(56, 151, 240, 0.15);
}

textarea.form-control {
    min-height: 160px;
    resize: vertical;
    line-height: 1.6;
}

/* ===== Button Styles ===== */
.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.social-note-btn {
    background: linear-gradient(45deg, #405DE6, #833AB4);
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.25s ease;
    flex: 1;
    min-width: 120px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.social-note-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3));
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}

.social-note-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-note-btn:hover::after {
    transform: translateX(100%);
}

.social-note-btn:disabled {
    background: #dbdbdb;
    transform: none !important;
    cursor: not-allowed;
    box-shadow: none;
}

.back-btn {
    background: #f5f5f5;
    color: #262626;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.back-btn:hover {
    background: #e0e0e0;
}

/* ===== Character Counter ===== */
.char-count {
    text-align: right;
    color: #8e8e8e;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.char-count.warning {
    color: #ff9500;
}

.char-count.error {
    color: #ff3b30;
}


/* ===== Note Header Styles ===== */
.note-header {
    position: absolute;
    top: 2.5rem;
    left: 0;
    right: 0;
    font-weight: 600;
    color: #262626;
    padding: 0 2.5rem 1rem;
    border-bottom: 1px solid #efefef;
    margin: 1rem 0;
    font-size: 1.4rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}



/* ===== Textarea Styles ===== */
#note-content {
    width: 100%;
    min-height: 200px; /* Increased from 150px */
    padding: 1rem;
    font-size: 16px; /* Base font size */
    line-height: 1.6;
}


/* ===== Note Preview ===== */
.note-preview-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2.5rem;
    perspective: 1000px;
}

.note-preview {
    background: #fff;
    border: 1px solid #BBBCBA;
    padding: 2.5rem;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    width: 570px;
    height: 713px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transform-style: preserve-3d;
    transition: transform 0.4s ease;
}

.note-preview:hover {
    transform: translateY(-5px) rotateX(2deg) rotateY(1deg);
}

.note-content {
    height: calc(100% - 120px); /* Adjusted for new header */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 3rem; /* Space for header */
}

#note-preview-text {
    font-size: 1.75rem;
    line-height: 1.6;
    margin: 0;
    word-break: break-word;
    color: #262626;
    text-align: left;
    font-weight: 500;
}

.note-footer {
    position: absolute;
    bottom: 2rem;
    left: 2.5rem;
    right: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    color: #8e8e8e;
    padding-top: 1.5rem;
    border-top: 1px solid #efefef;
    gap: 0.75rem;
}

.note-footer span {
    font-weight: 500;
    white-space: nowrap;
}

.note-footer span:last-child {
    color: #405DE6;
}

.note-hashtag {
    color: #405DE6;
    font-weight: 600;
}

.note-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}


/* Dynamic font sizing based on character limit */
.social-note-container[data-max-chars="140"] #note-preview-text {
    font-size: 38px;
}

.social-note-container[data-max-chars="160"] #note-preview-text {
    font-size: 36px;
}

.social-note-container[data-max-chars="180"] #note-preview-text,
.social-note-container[data-max-chars="200"] #note-preview-text {
    font-size: 34px;
    line-height: 1.4;
}


/* Background Image Styles */
.note-preview {
    position: relative;
    background-color: #fff;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.note-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.8);
    z-index: 1;
}

.note-content-wrapper {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Admin Styles */
.social-note-bg-settings .image-preview {
    border: 1px dashed #ccc;
    padding: 10px;
    margin-bottom: 10px;
    min-height: 50px;
}

.social-note-bg-settings input[type="range"] {
    vertical-align: middle;
    width: 200px;
    margin-top: 5px;
}




/* ===== Instagram-like Decoration ===== */
.note-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(90deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D);
}



/* ===== Color Schemes ===== */
.social-note-container[data-color-scheme="red"] .social-note-btn,
.social-note-container[data-color-scheme="red"] .note-preview::before {
    background: linear-gradient(45deg, #FF3131, #DA3C49, #FFAAAA, #FF8E8E);
}

.social-note-container[data-color-scheme="red"] .note-hashtag,
.social-note-container[data-color-scheme="red"] .social-note-step h2 {
    color: #BF1D2A;
}

.social-note-container[data-color-scheme="yellow"] .social-note-btn,
.social-note-container[data-color-scheme="yellow"] .note-preview::before {
    background: linear-gradient(45deg, #E37A3C, #EC9331, #EEB629, #DE4A22);
}

.social-note-container[data-color-scheme="yellow"] .note-hashtag,
.social-note-container[data-color-scheme="yellow"] .social-note-step h2 {
    color: #DE4A22;
}

.social-note-container[data-color-scheme="green"] .social-note-btn,
.social-note-container[data-color-scheme="green"] .note-preview::before {
    background: linear-gradient(45deg, #2A4F3D, #2E8B58, #3B5B09, #9D936D);
}

.social-note-container[data-color-scheme="green"] .note-hashtag,
.social-note-container[data-color-scheme="green"] .social-note-step h2 {
    color: #2A4F3D;
}

.social-note-container[data-color-scheme="black"] .social-note-btn,
.social-note-container[data-color-scheme="black"] .note-preview::before {
    background: linear-gradient(45deg, #000000, #737373, #A6A6A6, #332C33);
}

.social-note-container[data-color-scheme="black"] .note-hashtag,
.social-note-container[data-color-scheme="black"] .social-note-step h2 {
    color: #000000;
}

.social-note-container[data-color-scheme="instagram"] .social-note-btn,
.social-note-container[data-color-scheme="instagram"] .note-preview::before {
    background: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584);
}

.social-note-container[data-color-scheme="instagram"] .note-hashtag,
.social-note-container[data-color-scheme="instagram"] .social-note-step h2 {
    color: #405DE6;
}




/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .social-note-container {
        padding: 1.5rem;
        margin: 1rem auto;
    }

    .note-header {
        top: 1.5rem;
        left: 1.5rem;
        right: 1.5rem;
        font-size: 0.9rem;
        padding: 0 1.5rem 1rem;
    }

    .note-content {
        height: calc(100% - 100px);
        margin-top: 2.5rem;
    }

    .note-preview::before {
        height: 15px;
    }

    
    .note-preview {
        width: 100%;
        height: auto;
        aspect-ratio: 4/5;
        padding: 1.75rem;
    }
    
    #note-preview-text {
        font-size: 1.5rem;
    }
    
    .note-footer {
        left: 1.5rem;
        right: 1.5rem;
    }
    
    .note-hashtag {
        order: -1; /* Move hashtag to top on mobile */
    }
    
    .social-note-step h2 {
        font-size: 1.5rem;
    }
    
    .social-note-container[data-max-chars="140"] #note-preview-text {
    font-size: 18px;
}

    .social-note-container[data-max-chars="160"] #note-preview-text {
    font-size: 16px;
}

    .social-note-container[data-max-chars="180"] #note-preview-text,
    .social-note-container[data-max-chars="200"] #note-preview-text {
    font-size: 30px;
    line-height: 1.4;
}
    
    
}

@media (max-width: 480px) {
    
    /* Larger textarea and font for mobile */
    #note-content {
        min-height: 250px; /* Even taller on mobile */
        font-size: 22px; /* Larger font for mobile */
        padding: 0.8rem;
    }
    
    /* Larger character counter */
    
    .char-count {
        font-size: 14px;
    }
    
    /* Larger form inputs */
    #user-name, 
    #instagram-account {
        font-size: 18px !important;
        padding: 14px 12px !important;
        height: auto !important;
    }

    /* Larger labels */
    .form-group label {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }
    
    /* Larger "Start" button */
    #start-note {
        font-size: 18px !important;
        padding: 14px 20px !important;
    }
    
    /* Adjust form group spacing */
    .form-group {
        margin-bottom: 24px !important;
    }


    .social-note-container {
        padding: 1rem;
    }
    
    .note-preview {
        padding: 1.25rem;

    }
    
    #note-preview-text {
        font-size: 1.25rem;
    }

    /* Button container */
    .social-note-step .form-group + .button-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 10px;
        margin-top: 1rem;
    }

    /* Buttons */
    #preview-note, 
    #back-to-step1 {
        flex: 1;
        width: auto;
        margin: 0;
        font-size: 18px !important;
        padding: 14px 20px !important;
        white-space: nowrap;
    }

    #back-to-step1 {
        flex: 0.7;
        min-width: 80px;
    }


}

/* For very small devices (below 360px) */
@media (max-width: 360px) {
    #user-name, 
    #instagram-account {
        font-size: 16px !important;
        padding: 12px 10px !important;
    }
}




/* ===== Loading State ===== */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 0.5rem;
}

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