/* --- General Body & Typography Styling --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-header {
    text-align: center;
    margin-bottom: 1rem;
}

.main-header .logo {
    height: 50px;
    margin-bottom: 1.5rem;
}

.main-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.main-header p {
    font-size: 1.125rem;
    color: #4b5563;
}

/* --- NEW: Controls Container Styling --- */
.controls-container {
    width: 100%;
    max-width: 680px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.control-btn {
    background-color: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.control-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}


/* --- Search Container Styling --- */
.search-container {
    width: 100%;
    max-width: 680px;
    margin-bottom: 2rem;
}

#search-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
}

#search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* --- Main Link Container --- */
.link-container {
    width: 100%;
    max-width: 680px;
}

/* --- Folder Styling (The Accordion) --- */
.folder {
    margin-bottom: 1rem;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.folder-header {
    padding: 16px 20px;
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.folder-header:hover {
    background-color: #f9fafb;
}

.folder-header .arrow {
    transition: transform 0.3s ease;
    font-size: 1rem;
    color: #6b7280;
}

/* --- Folder Content Wrapper --- */
.folder-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out;
}

/* --- Active State (when folder is open) --- */
.folder.active > .folder-content {
    max-height: 2000px;
    padding: 8px 0;
}

.folder.active > .folder-header .arrow {
    transform: rotate(90deg);
}

/* --- Link List Styling --- */
.link-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.link-list li {
    transition: opacity 0.3s ease, background-color 0.2s ease; /* Added background-color transition */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    padding-right: 20px;
}

.link-list li:last-child {
    border-bottom: none;
}

.link-list li a {
    display: block;
    flex-grow: 1;
    padding: 14px 20px;
    color: #374151;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease; /* Transition color only */
}

/* Standard hover for the whole row (except when copy-hover is active) */
.link-list li:hover {
    background-color: #eff6ff; /* Light blue */
}
.link-list li:hover a {
    color: #1d4ed8;
}


/* --- Copy Button Styles --- */
.copy-btn {
    background-color: #3b82f6; /* Blue-500 */
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.link-list li:hover .copy-btn {
    background-color: #2563eb; /* Darker blue on hover */
}

.copy-btn.copied {
    background-color: #16a34a; /* Green-600 */
    color: white;
}

/* --- NEW: Special hover for the copy button --- */
/* This rule will override the standard li:hover when active */
.link-list li.copy-hover {
    background-color: #dcfce7; /* Light Green */
}
/* Keep the copy button's own hover effect */
.link-list li.copy-hover .copy-btn {
    background-color: #2563eb;
}
/* Make the link text dark on the green background for contrast */
.link-list li.copy-hover a {
    color: #1f2937;
}


/* --- Subfolder Container Styling --- */
.subfolder-container {
    padding: 10px 10px 0 20px;
    border-left: 2px solid #e5e7eb;
    margin-left: 20px;
}

.subfolder-container .folder {
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.subfolder-container .folder-header {
    font-size: 1rem;
    padding: 12px 16px;
}

/* --- Messages and Footer --- */
.empty-folder-message {
    padding: 14px 20px;
    color: #6b7280;
    font-style: italic;
    font-size: 0.9rem;
}

.empty-message, .error-message {
    text-align: center;
    padding: 20px;
    font-size: 1rem;
    color: #4b5563;
}

.error-message {
    color: #ef4444;
}

.main-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* --- Loading Spinner --- */
.loader {
    border: 5px solid #e5e7eb;
    border-top: 5px solid #3b82f6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

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