/* 
 * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
 * See LICENSE in the project root for license information.
 */

 html,
 body {
     width: 100%;
     height: 100%;
     margin: 0;
     padding: 0;
     font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
     background: #FFFFFF; 
     /* Ensure default text color is dark */
     color: #323130; 
     /* Ensure body fills height for flex alignment */
     display: flex;
     flex-direction: column;
     overflow: auto;
     scroll-behavior: smooth;
 }
 
 ul {
     margin: 0;
     padding: 0;
 }
 
.ms-welcome__header {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: transparent;
    border-bottom: none;
    flex-shrink: 0;
    margin-bottom: 0;
}

.header-top {
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
}

.header-top h1 {
    margin: 0;
}

.ms-welcome__header h1 {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    color: #1f4e7a;
    text-align: left;
    max-width: 100%;
}

.ms-welcome__header p {
    margin: 8px 0 0 0;
    font-size: 16px;
    line-height: 1.5;
    color: #605E5C;
    text-align: left;
    max-width: 100%;
    font-weight: 400;
}

 #auth-status {
    display: none;
 }

 #auth-status.authenticated {
    display: none;
 }

 #auth-status.not-authenticated {
    display: none;
 }

.ms-welcome__main {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0 24px 100px 24px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    position: relative;
    overflow-y: auto;
    min-height: 0;
}

.content-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
}

 .input-wrapper {
    width: 100%;
    position: relative;
    margin-bottom: 16px;
 }

 /* Combined styles for textarea and input */
 .input-field {
    width: 100%;
    min-height: 80px;
    max-height: 120px;
    resize: none;
    /* Adjusted padding */
    padding: 8px 12px; 
    font-size: 14px;
    /* Standard Fluent UI input border */
    border: 1px solid #C8C6C4; 
    /* Subtle border radius */
    border-radius: 2px; 
    background: #FFFFFF;
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: none; 
 }
 
 /* Specific style for textarea */
 textarea.input-field {
    /* Ensure consistent line height */
    line-height: 1.5;
    /* Allow vertical resize, prevent horizontal */
    resize: vertical;
    min-height: 60px; /* Minimum height */
 }
 
 .input-field:focus {
    outline: none;
    /* Fluent UI focus border color */
    border-color: #0078D4; 
    /* Remove box-shadow, rely on border */
    box-shadow: none; 
 }
 
 .enhance-button {
    position: absolute;
    right: 4px;
    /* Position relative to the top of the textarea */
    top: 4px; 
    transform: none; /* Remove vertical centering */
    background: #FFFFFF;
    border: 1px solid #C8C6C4; 
    border-radius: 2px;
    padding: 4px 8px;
    color: #323130;
    font-size: 12px;
    font-weight: 400; 
    cursor: pointer;
    transition: all 0.2s ease;
 }

 .enhance-button:hover {
    background: #F3F4F6;
    border-color: #A19F9D; /* Darker neutral border on hover */
 }
 
 #run.ms-welcome__action.ms-Button--hero {
    width: 100%;
    padding: 8px 12px;
    margin: 8px 0 16px 0;
    border-radius: 2px;
    background: #0078D4;
    border: 1px solid #0078D4;
    display: flex !important;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
 }

#run.ms-Button--hero .ms-Button-label {
    color: white;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    display: block;
    pointer-events: none;
}

.ms-Button.ms-Button--hero:hover {
    /* Standard Fluent UI hover blue */
    background: #005A9E; 
    border-color: #005A9E;
    /* Remove transform/shadow for standard feel */
    transform: none; 
    box-shadow: none; 
}

.ms-Button.ms-Button--hero.disabled {
    background: #F3F2F1;
    border-color: #C8C6C4;
    cursor: not-allowed;
    opacity: 0.6;
}

.ms-Button.ms-Button--hero.disabled:hover {
    background: #F3F2F1;
    border-color: #C8C6C4;
}

.ms-Button.ms-Button--hero.disabled .ms-Button-label {
    color: #A19F9D;
}

#sideload-msg {
    display: none;
}

.ms-welcome__features {
    width: 100%;
    margin-top: 20px;
}

.ms-welcome__features.ms-List .ms-ListItem {
    /* Use lighter background, subtle border */
    background: #F3F4F6; 
    border-radius: 2px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 1px solid #EDEBE9;
    /* Remove box-shadow for flatter look */
    box-shadow: none; 
}

b {
    font-weight: 600; /* Semibold is standard */
    color: #323130; /* Standard text */
}
/* Styles for the dropdown */
.dropdown-wrapper {
   width: 100%;
   margin-bottom: 12px; 
}

.dropdown-wrapper .ms-Label {
   display: block; /* Ensure label is on its own line */
   margin-bottom: 4px; /* Space between label and select */
   font-size: 14px;
   /* Change font-weight to regular */
   font-weight: 400; 
   color: #323130; /* Standard text */
}

.dropdown-field {
   width: 100%;
   padding: 8px 12px; /* Match input field */
   font-size: 14px;
   /* Change border color to match the button/focus blue */
   border: 1px solid #0078D4; 
   border-radius: 8px; /* Rounded corners as per image */
   background: #FFFFFF;
   box-sizing: border-box;
   transition: all 0.2s ease;
   appearance: none; /* Remove default browser styling */
   /* Add custom arrow */
   background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%23605E5C"><path d="M8 11.314 3.686 7h8.628L8 11.314z"/></svg>');
   background-repeat: no-repeat;
   background-position: right 8px center;
   background-size: 10px;
   padding-right: 30px; /* Make space for the arrow */
   /* Ensure dropdown text is dark */
   color: #323130;
}

.dropdown-field:focus {
   outline: none;
   border-color: #0078D4; /* Match input field focus */
}

/* Style for placeholder text in textarea */
textarea.input-field::placeholder {
    color: #605E5C; /* Use a slightly lighter dark gray for placeholders */
}

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    display: none;
    animation: slideDown 0.3s ease-out;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.notification.error {
    background-color: #FDE7E9;
    color: #D13438;
    border: 1px solid #F1707B;
}

.notification.success {
    background-color: #DFF6DD;
    color: #107C10;
    border: 1px solid #9AD29A;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Remove unused styles */
.ms-Button.ms-Button--credits,
.ms-Button.ms-Button--credits:hover,
.ms-Button.ms-Button--credits:active,
.ms-Button.ms-Button--credits .ms-Button-label,
.tokens-container,
.token-count,
#token-number,
#token-number.premium {
    display: none;
}

/* Loader styles */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.loader-container.active {
    display: flex;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0078D4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loader-text {
    color: #323130;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Cancel button styles */
.ms-Button.ms-Button--danger {
    background: #D13438;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ms-Button.ms-Button--danger:hover {
    background: #A4262C;
}

.ms-Button.ms-Button--danger:active {
    background: #751D1F;
}

.ms-Button.ms-Button--danger .ms-Button-label {
    color: white;
}

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

/* Auth Section Styles - Keeping for reference but not using directly */
.auth-section {
    display: none; /* Hide the auth section */
}

/* --- Auth Section Styles --- */
.auth-section {
    display: none; /* Hide the auth section */
}

#auth-status {
    margin-bottom: 12px; /* Space between status and buttons */
    text-align: center;
}

/* Color for authenticated status */
#auth-status.authenticated {
    color: #107C10; /* Fluent UI Success Green */
}

/* Color for not authenticated status */
#auth-status.not-authenticated {
    color: #605E5C; /* Fluent UI Neutral Secondary */
}

.auth-buttons {
    display: flex;
    gap: 10px; /* Space between buttons */
}

/* Improved logout button styles */
#logoutButton {
    background: transparent;
    border: 1px solid #0078D4;
    color: #0078D4;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

#logoutButton:hover {
    background: #f0f8ff;
    border-color: #005A9E;
    color: #005A9E;
}

#logoutButton:active {
    background: #deecf9;
    transform: scale(0.98);
}

#logoutButton.ms-Button--small .ms-Button-label {
    color: inherit;
    font-weight: inherit;
}

/* Enhanced authentication loading styles */
.auth-loading-content {
    width: 100%;
    max-width: 300px;
    margin: 0 auto 16px;
    text-align: center;
    display: none; /* Hidden by default, shown only during auth */
}

.auth-loading-step {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.auth-loading-step.active {
    display: block;
    opacity: 1;
}

.auth-loading-step h3 {
    color: #0078D4;
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-loading-step p {
    color: #605E5C;
    font-size: 14px;
    margin-bottom: 0;
}

/* Progress indicator for auth steps */
.auth-progress {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.auth-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #E1DFDD;
    margin: 0 5px;
    transition: background-color 0.3s ease;
}

.auth-progress-dot.active {
    background-color: #0078D4;
}

/* Animation for the spinner during auth */
.loader-container.active .loader-spinner {
    border-top-color: #0078D4;
    border-right-color: #0078D4;
    border-bottom-color: #0078D4;
    border-left-color: #0078D4;
    border-top-width: 3px;
    border-right-width: 3px;
    border-bottom-width: 3px;
    border-left-width: 3px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: rgba(0, 120, 212, 0.2);
    border-right-color: rgba(0, 120, 212, 0.2);
    border-bottom-color: rgba(0, 120, 212, 0.2);
    border-left-color: #0078D4;
    animation: spin 1s linear infinite;
}

/* Styles for the credits footer */
.credits-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #FFFFFF; /* Changed background to white */
    padding: 12px 24px; /* Increased vertical padding */
    box-sizing: border-box;
    z-index: 100;
    border-top: 1px solid #e1dfdd; /* Existing border */
}

/* Ensure the main content area doesn't overlap the fixed footer */
/* Adjust padding-bottom on .ms-welcome__main if needed, though it seems to be handled */

/* Styles for the logout button icon */
.ms-Button--icon {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.ms-Button--icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.ms-Button-icon {
    font-size: 20px;
    line-height: 1;
    color: #323130;
}

/* Style the container for credits info */
.credits-display {
    display: flex; /* Arrange items horizontally */
    align-items: center; /* Vertically align items in the middle */
    justify-content: space-between; /* Space out text and button */
    width: 100%; /* Take full width */
    font-size: 14px; /* Standard font size */
    color: #323130; /* Standard text color */
}

.credits-display span {
    white-space: nowrap;
}

/* Make token count slightly bolder */
#token-display {
    font-weight: 600;
}

/* Style the 'Get More Credits' button - more user-friendly */
#get-more-credits.ms-Button {
    margin: 0;
    padding: 4px 10px; /* Slightly more horizontal padding */
    font-size: 13px; /* Slightly larger */
    min-width: auto;
    height: auto;
    background-color: #FFFFFF; /* White background */
    border: 1px solid #0078D4; /* Primary blue border */
    color: #0078D4; /* Primary blue text */
    border-radius: 4px; /* Slightly rounded corners */
    box-shadow: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 600; /* Semibold */
    cursor: pointer;
}

#get-more-credits.ms-Button:hover {
    background-color: #EFF6FC; /* Very light blue hover */
    border-color: #005A9E; /* Darker blue border */
    color: #005A9E; /* Darker blue text */
    box-shadow: none;
}

#get-more-credits.ms-Button:active {
    background-color: #DEECF9; /* Slightly darker active */
    border-color: #005A9E;
    color: #005A9E;
    box-shadow: none;
    transform: scale(0.98); /* Subtle click effect */
}

#get-more-credits.ms-Button .ms-Button-label {
    /* Label styles are handled directly on the button now */
    /* font-weight: 400; */ /* Removed - using font-weight on button */
    color: inherit;
}

#get-more-credits.ms-Button.disabled,
#get-more-credits.ms-Button:disabled {
    background-color: #F3F2F1;
    border-color: #C8C6C4;
    color: #A19F9D;
    cursor: not-allowed;
}

#get-more-credits.ms-Button.disabled:hover,
#get-more-credits.ms-Button:disabled:hover {
    background-color: #F3F2F1;
    border-color: #C8C6C4;
    transform: none; /* Remove click effect on disabled */
}

/* Style for premium token display */
#token-display.premium {
    font-weight: 600;
}

/* Font Recommender Styles */
.color-count-wrapper {
    width: 100%;
    margin-bottom: 20px;
}

.color-count-wrapper .ms-Label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #323130;
}

.color-count-field {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid #C8C6C4;
    border-radius: 2px;
    background: #FFFFFF;
    box-sizing: border-box;
    transition: all 0.2s ease;
    color: #323130;
}

.color-count-field:focus {
    outline: none;
    border-color: #0078D4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
}

.palette-description-wrapper {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}

.palette-description-wrapper .ms-Label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #323130;
}

.palette-description-field {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid #C8C6C4;
    border-radius: 2px;
    background: #FFFFFF;
    box-sizing: border-box;
    transition: all 0.2s ease;
    color: #323130;
    resize: vertical;
    line-height: 1.5;
}

.palette-description-field:focus {
    outline: none;
    border-color: #0078D4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
}

.palette-description-field::placeholder {
    color: #A0A0A0;
}

.character-counter {
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 12px;
    color: #A0A0A0;
    background: #FFFFFF;
    padding: 2px 4px;
}


.generate-palette-btn {
    background: #0078D4 !important;
    border-color: #0078D4 !important;
    width: 100%;
    height: 48px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.generate-palette-btn:hover {
    background: #005A9E !important;
    border-color: #005A9E !important;
    transform: none;
    box-shadow: none;
}

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

.generate-palette-btn .ms-Button-label {
    color: white !important;
}

/* Updated credits footer styles */
.credits-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.credits-display span {
    font-size: 12px;
    color: #323130;
    white-space: normal;
    font-weight: 400;
}

.get-more-credits-link {
    color: #0078D4;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s ease;
    font-weight: 500;
    position: relative;
}

.get-more-credits-link:hover {
    color: #005A9E;
    text-decoration: underline;
}

.get-more-credits-link::after {
    content: "↗";
    font-size: 10px;
    margin-left: 2px;
    opacity: 0.7;
}

.powered-by {
    text-align: center;
    margin-top: 8px;
}

.powered-by span {
    font-size: 12px;
    color: #323130;
    font-weight: 400;
}


.logout-btn {
    background: transparent;
    border: 1px solid #0078D4;
    color: #0078D4;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #0078D4;
    color: white;
}

.logout-btn .ms-Button-icon {
    color: inherit;
}


/* Color Results Styles */
.color-results-container {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    flex-shrink: 0;
    animation: fadeInUp 0.5s ease-out;
}

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

.results-title {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #323130;
}

.color-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 8px;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    transition: all 0.2s ease;
}

.color-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #0078D4;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid #e1e5e9;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-info {
    flex: 1;
    min-width: 0;
}

.color-name {
    font-size: 14px;
    font-weight: 600;
    color: #323130;
    margin: 0 0 4px 0;
}

.color-hex {
    font-size: 12px;
    color: #605e5c;
    font-family: 'Courier New', monospace;
    margin: 0;
}

.apply-btn {
    background: #0078D4;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.apply-btn:hover {
    background: #005A9E;
    transform: none;
}

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

/* Scrollbar styling for color list */
.color-list::-webkit-scrollbar {
    width: 6px;
}

.color-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.color-list::-webkit-scrollbar-thumb {
    background: #0078D4;
    border-radius: 3px;
}

.color-list::-webkit-scrollbar-thumb:hover {
    background: #005A9E;
}
