/**
 * Circle Faces Generator - Styles
 * NetDynamic v1.0.0
 */

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

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #fff;
    min-height: 100vh;
    padding-top: 15px;
    padding-bottom: 20px;
}


.app-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 10px;
    overflow: hidden;
}

/* Display Mode - Screenshot Area */
#displayMode {
    background: #ffffff;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 20px;
    overflow: visible;
}

#circlesContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 7px 3px;
    gap: 2px;
    background-size: cover;
    background-position: center;
    height: 100px;
    min-height: 100px;
    max-height: 100px;
    overflow: visible;
    width: 100%;
    max-width: 100%;
}

.circle-entry {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    vertical-align: bottom;
    margin-top: 6px;
}

.position-number {
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 1px #000;
}

.profile-circle {
    border-radius: 50%;
    border: 2px solid #FFD700;
    overflow: hidden;
    background: #333;
}

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

.profile-circle.empty-circle {
    background: #ddd;
    border-color: #999;
}

.profile-circle.text-circle {
    background: linear-gradient(135deg, #667eea, #764ba2);
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-name {
    font-weight: bold;
    color: #333;
    overflow: visible;
    white-space: nowrap;
    text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}

.circle-topper img {
    object-fit: contain;
}

/* Controls Panel */
#controlsPanel {
    background: #16213e;
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    border-radius: 10px;
    box-sizing: border-box;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #0f3460;
}

.controls-header h2 {
    font-size: 16px;
    color: #e94560;
}

.add-user-link {
    color: #00f2ea;
    text-decoration: none;
    font-size: 11px;
    margin-left: 8px;
}

.add-user-link:hover {
    text-decoration: underline;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    background: #0f3460;
    border: none;
    color: #888;
    cursor: pointer;
    border-radius: 5px;
}

.tab-btn.active {
    background: #e94560;
    color: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Control Sections */
.control-section {
    margin-bottom: 15px;
}

.control-section label {
    display: block;
    font-size: 12px;
    color: #aaa;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.control-section input[type="text"],
.control-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #0f3460;
    border-radius: 5px;
    background: #1a1a2e;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
}

/* Background Controls */
.bg-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#bgFileName {
    font-size: 12px;
    color: #888;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toppers Grid */
.toppers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.topper-item {
    width: 50px;
    height: 50px;
    border: 2px solid #0f3460;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.topper-item img {
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
}

.topper-item.selected {
    border-color: #e94560;
    background: #2a2a4e;
}

.topper-item .topper-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 8px;
    background: rgba(0,0,0,0.7);
    text-align: center;
    padding: 2px;
}

.add-topper-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.add-topper-row input[type="text"] {
    flex: 1;
}

/* Search Container */
.search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a2e;
    border: 1px solid #e94560;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    gap: 10px;
}

.search-result-item:hover {
    background: #0f3460;
}

.search-result-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.search-result-item .no-image {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Selected Users List */
.selected-users-list {
    min-height: 60px;
    background: #1a1a2e;
    border: 1px dashed #0f3460;
    border-radius: 5px;
    padding: 10px;
}

.selected-user-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: #0f3460;
    border-radius: 5px;
    margin-bottom: 8px;
    cursor: grab;
    gap: 10px;
}

.selected-user-item:active {
    cursor: grabbing;
}

.selected-user-item.dragging {
    opacity: 0.5;
}

.selected-user-item .drag-handle {
    color: #666;
    cursor: grab;
}

.selected-user-item .user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFD700;
}

.selected-user-item .user-avatar-placeholder {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid #FFD700;
}

.selected-user-item .user-info {
    flex: 1;
}

.selected-user-item .user-name {
    font-size: 14px;
    font-weight: bold;
}

.selected-user-item .user-position {
    font-size: 10px;
    color: #888;
}

.selected-user-item .topper-select {
    display: flex;
    align-items: center;
    gap: 5px;
}

.selected-user-item .topper-preview {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

.selected-user-item .topper-dropdown {
    background: #1a1a2e;
    border: 1px solid #0f3460;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.selected-user-item .remove-btn {
    background: #e94560;
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

/* Buttons */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: #e94560;
    color: #fff;
}

.btn-secondary {
    background: #0f3460;
    color: #fff;
}

.btn-danger {
    background: #c0392b;
    color: #fff;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Action Buttons Row */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #0f3460;
}

.action-buttons .btn {
    flex: 1;
    min-width: 100px;
}

/* Image Overlay (for WeChat/Safari screenshot) */
#imageOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlay-content {
    text-align: center;
    padding: 20px;
    max-width: 100%;
}

.overlay-content p {
    margin-bottom: 15px;
    font-size: 14px;
    color: #ccc;
}

.overlay-content img {
    max-width: 100%;
    max-height: 70vh;
    border: 2px solid #fff;
}

.overlay-content button {
    margin-top: 15px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #16213e;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #0f3460;
}

.modal-header h3 {
    font-size: 16px;
    color: #e94560;
}

.close-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 15px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #0f3460;
    border-radius: 5px;
    background: #1a1a2e;
    color: #fff;
    font-size: 14px;
    margin-bottom: 10px;
}

/* Saved Configs List */
#savedConfigsList .config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #0f3460;
    border-radius: 5px;
    margin-bottom: 8px;
}

#savedConfigsList .config-item .config-info {
    flex: 1;
}

#savedConfigsList .config-item .config-name {
    font-weight: bold;
}

#savedConfigsList .config-item .config-meta {
    font-size: 11px;
    color: #888;
}

#savedConfigsList .config-item .config-actions {
    display: flex;
    gap: 5px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Drag and Drop Placeholder */
.drag-placeholder {
    background: #0f3460;
    border: 2px dashed #e94560;
    border-radius: 5px;
    height: 50px;
    margin-bottom: 8px;
}
