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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #1a1d23;
    color: #e9ecef;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #2d3748;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #4a5568;
}

header h1 {
    color: #f7fafc;
    margin-bottom: 8px;
}

header p {
    color: #a0aec0;
}

.config-section {
    background: #2d3748;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #4a5568;
    margin-bottom: 30px;
}

.config-section.expanded {
    padding: 25px;
}

.config-header {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    margin-bottom: 0;
}

.config-header:hover {
    background-color: #4a5568;
}

.config-header h2 {
    margin: 0;
    color: #f7fafc;
    display: flex;
    align-items: center;
    font-size: 1.2rem;
}

.config-content {
    margin-top: 10px;
}

.config-instructions {
    margin-bottom: 20px;
    color: #a0aec0;
    font-style: italic;
    padding: 10px;
    background: #1a202c;
    border-radius: 4px;
    border-left: 4px solid #63b3ed;
}

.config-grid {
    display: grid;
    gap: 20px;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-item label {
    font-weight: 600;
    color: #f7fafc;
}

.config-item input {
    padding: 12px;
    border: 2px solid #4a5568;
    border-radius: 6px;
    font-size: 16px;
    background-color: #1a202c;
    color: #e9ecef;
}

.config-item input:focus {
    outline: none;
    border-color: #63b3ed;
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}


.token-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.token-input-group input {
    flex: 1;
}

.toggle-btn {
    padding: 8px 16px;
    font-size: 14px;
    min-width: 60px;
}

.token-help {
    margin-top: 10px;
}

.token-help summary {
    cursor: pointer;
    color: #63b3ed;
    font-weight: 500;
    padding: 8px 0;
}

.token-help summary:hover {
    color: #90cdf4;
}

.help-content {
    margin-top: 12px;
    padding: 16px;
    background: #1a202c;
    border-radius: 6px;
    border: 1px solid #2d3748;
}

.help-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.help-content li {
    margin-bottom: 6px;
    color: #e9ecef;
}

.help-content a {
    color: #63b3ed;
    text-decoration: none;
}

.help-content a:hover {
    color: #90cdf4;
    text-decoration: underline;
}

.help-content code {
    background: #2d3748;
    padding: 2px 6px;
    border-radius: 3px;
    color: #fbb6ce;
    font-family: 'Courier New', monospace;
}

.config-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.category-search {
    margin: 20px 0;
    padding: 15px;
    background: #1a202c;
    border-radius: 6px;
    border: 1px solid #2d3748;
}

.category-search h4 {
    margin-bottom: 10px;
    color: #f7fafc;
    font-size: 1.1em;
}

.search-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-group input {
    flex: 1;
    min-width: 250px;
    box-sizing: border-box;
}

.search-results {
    margin-top: 20px;
}

.search-result-item {
    background: #1a202c;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.app-icon {
    flex-shrink: 0;
}

.app-icon img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.app-info {
    flex: 1;
    min-width: 200px;
}

.app-name {
    font-weight: 600;
    color: #f7fafc;
    margin-bottom: 4px;
}

.app-package {
    font-family: 'Courier New', monospace;
    color: #a0aec0;
    font-size: 14px;
}

.app-developer {
    color: #9ca3af;
    font-size: 13px;
    margin-top: 2px;
}

.app-rating {
    color: #fbbf24;
    font-size: 13px;
    margin-top: 2px;
}

.app-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.category-select {
    padding: 8px 12px;
    border: 2px solid #4a5568;
    border-radius: 4px;
    background-color: #1a202c;
    color: #e9ecef;
    font-size: 14px;
    min-width: 150px;
}

.category-select:focus {
    outline: none;
    border-color: #63b3ed;
}

.no-results {
    color: #a0aec0;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #4299e1;
    color: white;
    border: 1px solid #4299e1;
}

.btn-primary:hover {
    background-color: #3182ce;
    border-color: #3182ce;
}

.btn-secondary {
    background-color: #4a5568;
    color: white;
    border: 1px solid #4a5568;
}

.btn-secondary:hover {
    background-color: #2d3748;
    border-color: #2d3748;
}

.btn-success {
    background-color: #48bb78;
    color: white;
    border: 1px solid #48bb78;
}

.btn-success:hover {
    background-color: #38a169;
    border-color: #38a169;
}

.btn-danger {
    background-color: #f56565;
    color: white;
    border: 1px solid #f56565;
}

.btn-danger:hover {
    background-color: #e53e3e;
    border-color: #e53e3e;
}

.btn-delete-category {
    width: auto !important;
    min-width: 90px;
    padding: 10px 18px !important;
    font-size: 15px !important;
}

.add-category {
    background: #2d3748;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #4a5568;
    margin-bottom: 30px;
}

.add-category h2 {
    margin-bottom: 15px;
    color: #f7fafc;
}

.form-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

input[type="text"] {
    padding: 12px;
    border: 2px solid #4a5568;
    border-radius: 6px;
    font-size: 16px;
    flex: 1;
    min-width: 250px;
    background-color: #1a202c;
    color: #e9ecef;
    box-sizing: border-box;
    width: 100%;
}

input[type="text"]:focus {
    outline: none;
    border-color: #63b3ed;
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

.category {
    background: #2d3748;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border: 1px solid #4a5568;
    margin-bottom: 20px;
}

.category.expanded {
    padding: 25px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.category.expanded .category-header {
    margin-bottom: 20px;
    padding: 10px;
}

.category-header:hover {
    background-color: #4a5568;
}

.collapse-icon {
    margin-right: 10px;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.category-content {
    margin-top: 10px;
}

.category-title {
    font-size: 1.4em;
    color: #f7fafc;
    margin: 0;
    display: flex;
    align-items: center;
}

.package-list {
    list-style: none;
    margin-bottom: 20px;
}

.package-item {
    background: #1a202c;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #63b3ed;
    border: 1px solid #2d3748;
}

.package-name {
    font-family: 'Courier New', monospace;
    color: #e9ecef;
    font-weight: 500;
    font-size: 16px;
}

.add-package {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.add-package input {
    flex: 1;
    min-width: 300px;
    box-sizing: border-box;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
}

.error {
    background-color: #feb2b2;
    color: #ffffff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #fc8181;
}

.success {
    background-color: #9ae6b4;
    color: #ffffff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #68d391;
}

/* Mobile and Tablet Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
        max-width: 100%;
    }
    
    .config-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 12px;
        max-width: 100%;
        margin: 0;
    }
    
    header {
        padding: 16px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.3rem;
        line-height: 1.3;
    }
    
    header p {
        font-size: 0.85rem;
    }
    
    .config-section,
    .add-category,
    .category {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .config-section.expanded,
    .category.expanded {
        padding: 16px;
    }
    
    .config-section h2,
    .add-category h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .controls .btn:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
        max-width: 50%;
    }
    
    .controls .btn {
        width: 100%;
        padding: 8px 10px;
        font-size: 13px;
        box-sizing: border-box;
    }
    
    .form-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .form-group .btn {
        width: 100%;
        margin-top: 8px;
        padding: 8px 10px;
        font-size: 13px;
    }
    
    input[type="text"],
    .config-item input {
        width: 100%;
        min-width: 0;
        font-size: 15px;
        padding: 12px 10px;
        box-sizing: border-box;
    }
    
    .add-package {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .add-package input {
        width: 100%;
        min-width: 0;
    }
    
    .add-package .btn {
        width: 100%;
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .category-header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        margin-bottom: 0;
        flex-wrap: wrap;
    }
    
    .category.expanded .category-header {
        margin-bottom: 16px;
    }
    
    .category-title {
        font-size: 1.0rem;
        margin: 0;
        flex: 1;
        min-width: 0;
    }
    
    .btn-delete-category {
        width: auto !important;
        min-width: 70px !important;
        padding: 8px 14px !important;
        font-size: 13px !important;
        flex-shrink: 0;
    }
    
    .package-item {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        align-items: flex-start;
    }
    
    .package-item .btn {
        width: auto;
        min-width: 80px;
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .token-input-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .token-input-group input {
        width: 100%;
    }
    
    .toggle-btn {
        width: 100%;
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .search-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .search-group input {
        width: 100%;
        min-width: 0;
    }
    
    .search-group .btn {
        width: 100%;
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .search-result-item {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 14px;
        align-items: stretch;
    }
    
    .app-icon img {
        width: 40px;
        height: 40px;
        align-self: flex-start;
    }
    
    .app-info {
        width: 100%;
        min-width: 0;
    }
    
    .app-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    
    .app-actions .btn:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
        max-width: 50%;
    }
    
    .app-actions .btn {
        width: 100%;
        font-size: 12px;
        padding: 8px 10px;
        box-sizing: border-box;
    }
    
    .category-select {
        width: 100%;
        min-width: 0;
        padding: 12px;
        font-size: 16px;
    }
    
    .help-content {
        padding: 12px;
    }
    
    .help-content ol {
        margin-left: 16px;
        padding-right: 8px;
    }
    
    .config-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .config-actions .btn:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
        max-width: 50%;
    }
    
    .config-actions .btn {
        width: 100%;
        padding: 8px 10px;
        font-size: 13px;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header {
        padding: 12px;
    }
    
    header h1 {
        font-size: 1.1rem;
    }
    
    header p {
        font-size: 0.8rem;
    }
    
    .config-section,
    .add-category,
    .category {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .config-section.expanded,
    .category.expanded {
        padding: 12px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .category-title {
        font-size: 0.9rem;
    }
    
    .btn-delete-category {
        min-width: 60px !important;
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    
    .package-name {
        font-size: 14px;
        word-break: break-all;
        line-height: 1.4;
    }
    
    .app-name {
        font-size: 13px;
        line-height: 1.3;
    }
    
    .app-package {
        font-size: 11px;
        word-break: break-all;
        line-height: 1.3;
    }
    
    input[type="text"],
    .config-item input,
    .category-select {
        padding: 10px 8px;
        font-size: 14px;
    }
}