/* static/css/styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Login Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-box {
    background: rgba(30, 30, 50, 0.8);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
}

.login-box h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #a0a0ff;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #444;
    background: rgba(15, 15, 30, 0.8);
    color: #e0e0e0;
    font-size: 1rem;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.error-message {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid #ff6b6b;
    border-radius: 8px;
    color: #ff6b6b;
    font-size: 0.85rem;
    display: none;
}

.error-message.show {
    display: block;
}

.login-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #444;
    font-size: 0.8rem;
    color: #808080;
}

.login-info p {
    margin-bottom: 0.4rem;
}

/* App Container */
.app-container {
    padding: 1rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.user-info #user-name {
    font-weight: 600;
    color: #a0a0ff;
    font-size: 0.9rem;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.role-badge.admin {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.role-badge.coordinator {
    background: linear-gradient(135deg, #ffd93d 0%, #f8b500 100%);
    color: #1a1a2e;
}

.role-badge.dancer {
    background: linear-gradient(135deg, #4ecdc4 0%, #45b7d1 100%);
    color: white;
}

.dance-selector {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dance-selector label {
    font-size: 1rem;
    font-weight: 600;
    color: #a0a0ff;
}

#dance-select {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 2px solid #667eea;
    background: rgba(30, 30, 50, 0.8);
    color: #e0e0e0;
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 200px;
    flex: 1;
    max-width: 300px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

#dance-select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.main-container {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    align-items: flex-start;
    flex-direction: column;
}

.left-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.center-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info {
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 0 1rem;
}

.formation-label {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #a0a0ff;
}

.sequence-info {
    font-size: 0.9rem;
    color: #808080;
}

.stage-container {
    background: rgba(30, 30, 50, 0.5);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

svg {
    display: block;
    background: rgba(15, 15, 30, 0.8);
    border-radius: 10px;
    max-width: 100%;
    height: auto;
}

.dancer-group {
    transition: opacity 0.5s ease-in-out;
}

.dancer-circle {
    transition: cx 0.8s ease-in-out, cy 0.8s ease-in-out, fill 0.3s ease-in-out;
}

.dancer-circle.ill {
    fill: none;
    stroke-width: 3;
    stroke-dasharray: 5, 5;
}

.dancer-name {
    font-size: 11px;
    font-weight: 600;
    fill: white;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: x 0.8s ease-in-out, y 0.8s ease-in-out;
}

.replacement-badge {
    font-size: 8px;
    font-weight: 700;
    fill: #ffd93d;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: x 0.8s ease-in-out, y 0.8s ease-in-out;
}

.ill-badge-svg {
    font-size: 8px;
    font-weight: 700;
    fill: #ff6b6b;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: x 0.8s ease-in-out, y 0.8s ease-in-out;
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.panel {
    background: rgba(30, 30, 50, 0.5);
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.panel h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #a0a0ff;
}

.dancer-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dancer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(15, 15, 30, 0.6);
    border-radius: 8px;
    transition: background 0.2s;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dancer-item:hover {
    background: rgba(15, 15, 30, 0.8);
}

.dancer-item.ill {
    border-left: 3px solid #ff6b6b;
}

.dancer-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.dancer-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    flex-shrink: 0;
}

.dancer-name-text {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ill-badge {
    background: #ff6b6b;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.dancer-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
    white-space: nowrap;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.btn-success {
    background: linear-gradient(135deg, #6bcf7f 0%, #78e08f 100%);
}

.replacement-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(255, 217, 61, 0.1);
    border-left: 3px solid #ffd93d;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.replacement-info {
    font-size: 0.85rem;
    flex: 1;
}

.arrow {
    color: #ffd93d;
    font-weight: bold;
    margin: 0 0.5rem;
}

select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #444;
    background: rgba(15, 15, 30, 0.8);
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

select:focus {
    outline: none;
    border-color: #667eea;
}

.replacement-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(15, 15, 30, 0.6);
    border-radius: 8px;
    flex-wrap: wrap;
}

.replacement-form select {
    flex: 1;
    min-width: 120px;
}

.no-replacements {
    color: #808080;
    font-style: italic;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

.add-dancer-section {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(15, 15, 30, 0.6);
    border-radius: 8px;
    flex-wrap: wrap;
}

.add-dancer-section input {
    flex: 1;
    min-width: 150px;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #444;
    background: rgba(15, 15, 30, 0.8);
    color: #e0e0e0;
    font-size: 0.85rem;
    -webkit-appearance: none;
    appearance: none;
}

.add-dancer-section input:focus {
    outline: none;
    border-color: #667eea;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(15, 15, 30, 0.6);
    border-radius: 8px;
}

.user-form input,
.user-form select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #444;
    background: rgba(15, 15, 30, 0.8);
    color: #e0e0e0;
    font-size: 0.85rem;
    -webkit-appearance: none;
    appearance: none;
}

.user-form input:focus,
.user-form select:focus {
    outline: none;
    border-color: #667eea;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(15, 15, 30, 0.6);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.user-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.user-item-info strong {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.user-actions select {
    min-width: 100px;
}

#users-list {
    margin-bottom: 1rem;
}

/* Tablet Styles */
@media (min-width: 768px) {
    .app-container {
        padding: 1.5rem;
    }

    .app-header h1 {
        font-size: 2rem;
    }

    .login-box {
        padding: 2.5rem;
    }

    .login-box h1 {
        font-size: 2rem;
    }

    .main-container {
        flex-direction: row;
        gap: 2rem;
    }

    .left-panel {
        width: 380px;
        max-width: 380px;
    }

    .center-panel {
        flex: 1;
    }

    .stage-container {
        padding: 1.5rem;
    }

    .formation-label {
        font-size: 1.5rem;
    }

    .sequence-info {
        font-size: 1rem;
    }

    button {
        font-size: 1rem;
        padding: 0.75rem 2rem;
    }

    .panel h2 {
        font-size: 1.25rem;
    }

    .dancer-name-text,
    .user-item-info strong {
        font-size: 1rem;
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .app-container {
        padding: 2rem;
    }

    .app-header h1 {
        font-size: 2.5rem;
    }

    .login-box {
        padding: 3rem;
    }

    .main-container {
        gap: 2rem;
    }

    .left-panel {
        width: 400px;
        max-width: 400px;
    }

    .stage-container {
        padding: 2rem;
    }
}

/* Touch Interactions */
@media (hover: none) and (pointer: coarse) {
    button:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    
    .dancer-item:hover {
        background: rgba(15, 15, 30, 0.6);
    }
}

/* Landscape Mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .app-header {
        margin-bottom: 1rem;
    }

    .dance-selector {
        margin-bottom: 1rem;
    }

    .stage-container {
        margin-bottom: 1rem;
    }

    .info {
        margin-bottom: 1rem;
    }

    svg {
        width: 100%;
        height: auto;
    }
}

/* Very Small Screens */
@media (max-width: 360px) {
    .app-header h1 {
        font-size: 1.25rem;
    }

    .formation-label {
        font-size: 1.1rem;
    }

    .sequence-info {
        font-size: 0.85rem;
    }

    .btn-small {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* Prevent text selection on touch devices */
@media (hover: none) {
    .dancer-name-text,
    .user-item-info strong,
    .role-badge,
    .ill-badge {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Fix iOS input zoom */
@media (max-width: 767px) {
    input[type="text"],
    input[type="password"],
    select {
        font-size: 16px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 15, 30, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* static/css/styles.css - Add these styles to the existing file */

/* ... existing styles ... */

.stage-container {
    background: rgba(30, 30, 50, 0.5);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
}

.zoom-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.zoom-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.3);
    border: 1px solid #667eea;
}

.zoom-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.svg-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    position: relative;
}

svg {
    display: block;
    background: rgba(15, 15, 30, 0.8);
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    cursor: grab;
    transition: transform 0.3s ease;
}

svg:active {
    cursor: grabbing;
}

.reset-view-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.5);
    z-index: 10;
}

/* Pinch zoom indicator for mobile */
.zoom-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.zoom-hint.show {
    opacity: 1;
}

/* Mobile optimizations for zoom */
@media (max-width: 767px) {
    .stage-container {
        padding: 0.75rem;
    }

    .svg-container {
        touch-action: pan-x pan-y pinch-zoom;
    }

    svg {
        min-width: 100%;
        min-height: 400px;
    }
}

@media (min-width: 768px) {
    .zoom-controls {
        display: none;
    }
    
    .zoom-hint {
        display: none;
    }
}

/* Audience marker styles */
#audience-marker {
    opacity: 0.9;
}

#audience-marker line {
    stroke: #ffd93d;
    stroke-width: 3;
    stroke-dasharray: 10, 5;
}

#audience-marker text {
    fill: #ffd93d;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 700;
    font-size: 16px;
    text-anchor: middle;
    user-select: none;
    pointer-events: none;
    letter-spacing: 2px;
}

#audience-marker path {
    fill: #ffd93d;
}

/* Mobile responsive audience marker */
@media (max-width: 767px) {
    #audience-marker text {
        font-size: 14px;
        letter-spacing: 1px;
    }
    
    #audience-marker line {
        stroke-width: 2;
    }
}

/* Very small screens - hide side audience text */
@media (max-width: 500px) {
    #audience-marker text:first-of-type,
    #audience-marker text:last-of-type {
        display: none;
    }
}

/* Pair-specific styles */
.dancer-group.pair {
    transition: opacity 0.5s ease-in-out;
}

.pair-connector {
    stroke: #888;
    stroke-width: 2;
    transition: x1 0.8s ease-in-out, y1 0.8s ease-in-out, 
                x2 0.8s ease-in-out, y2 0.8s ease-in-out;
}

.pair-label {
    font-size: 9px;
    font-weight: 700;
    fill: #888;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0.8;
    letter-spacing: 1px;
}

/* Smaller circles for pairs */
.dancer-group.pair .dancer-circle {
    r: 10;
}

/* Smaller text for pairs */
.dancer-group.pair .dancer-name {
    font-size: 9px;
}

/* Pair badges positioned lower */
.dancer-group.pair .replacement-badge,
.dancer-group.pair .ill-badge-svg {
    y: 40;
}

/* Visual distinction for pairs on hover */
.dancer-group.pair:hover .pair-connector {
    stroke: #aaa;
    stroke-width: 3;
}

.dancer-group.pair:hover .pair-label {
    opacity: 1;
    fill: #aaa;
}

/* Mobile optimizations for pairs */
@media (max-width: 767px) {
    .pair-label {
        font-size: 8px;
    }
    
    .dancer-group.pair .dancer-name {
        font-size: 8px;
    }
}

/* Very small screens - hide pair label to reduce clutter */
@media (max-width: 500px) {
    .pair-label {
        display: none;
    }
}
