/**
 * Reparto Cooperativo - Estilos v2.1.8
 * Estética unificada con Mejora Colectiva
 */

/* Variables - Alineadas con Mejora Colectiva */
:root {
    --rc-accent: #e0e0e0;
    --rc-accent-alt: #1DB954;
    --rc-border: rgba(255, 255, 255, 0.14);
    --rc-text: #f2f2f2;
    --rc-text-muted: rgba(242, 242, 242, 0.6);
    --rc-bg-card: rgba(255, 255, 255, 0.06);
    --rc-bg-hover: rgba(255, 255, 255, 0.08);
    --rc-bg-input: rgba(255, 255, 255, 0.05);
    --rc-success: #4CAF50;
    --rc-danger: #f44336;
    --rc-warning: #ff9800;
}

/* Reset y Base */
.rc-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    color: var(--rc-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.5;
}

.rc-wrap *,
.rc-wrap *::before,
.rc-wrap *::after {
    box-sizing: border-box;
}

/* Cards */
.rc-card {
    background: var(--rc-bg-card);
    border: 1px solid var(--rc-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.rc-card-main {
    padding: 1.5rem 1.5rem 1rem;
}

.rc-card-results {
    background: rgba(0, 0, 0, 0.3);
}

/* Header */
.rc-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.rc-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
    color: var(--rc-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Íconos SVG */
.rc-icon-svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--rc-accent-alt);
}

.rc-icon-svg-small {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.rc-label-icon-svg {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 0.25rem;
    opacity: 0.8;
}

.rc-btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.rc-empty-icon-svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
    margin-bottom: 0.5rem;
}

.rc-subtitle {
    color: var(--rc-text-muted);
    margin: 0;
    font-size: 0.95rem;
}

/* Input Section */
.rc-input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.rc-amount-field {
    width: 100%;
}

.rc-amount-field label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.rc-input-with-prefix {
    position: relative;
    display: flex;
    align-items: stretch;
}

.rc-prefix {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 0.8rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--rc-border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: var(--rc-text-muted);
    font-weight: 600;
}

.rc-input-with-prefix input {
    width: 100%;
    padding: 0.7rem 0.8rem 0.7rem 2.5rem;
    background: var(--rc-bg-input);
    border: 1px solid var(--rc-border);
    border-radius: 8px;
    color: var(--rc-text);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.rc-input-with-prefix input:focus {
    outline: none;
    border-color: var(--rc-accent);
    background: rgba(255, 255, 255, 0.08);
}

.rc-input-with-prefix input::placeholder {
    color: rgba(242, 242, 242, 0.4);
}

/* Navegación / Botones */
.rc-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.rc-nav .cs-glass-btn {
    flex: 1 1 auto;
    min-width: 120px;
    justify-content: center;
}

/* Botones estilo Mejora Colectiva */
.rc-wrap .cs-glass-btn {
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--rc-border);
    background: linear-gradient(135deg, #ffffff, #cccccc);
    color: #111;
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    line-height: 1.2;
    min-height: 32px;
    white-space: nowrap;
}

.rc-wrap .cs-glass-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.rc-wrap .cs-glass-btn:active {
    transform: translateY(0);
}

.rc-wrap .cs-glass-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.rc-btn-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--rc-text) !important;
}

.rc-btn-ghost {
    background: transparent !important;
    color: var(--rc-text) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.rc-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.rc-btn-primary {
    background: linear-gradient(135deg, #1DB954, #1ed760) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.rc-btn-primary:hover {
    background: linear-gradient(135deg, #1ed760, #2de970) !important;
}

.rc-btn-large {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    min-height: 38px !important;
}

.rc-btn-danger {
    background: rgba(244, 67, 54, 0.15) !important;
    color: #ff8a80 !important;
    border-color: rgba(244, 67, 54, 0.3) !important;
}

.rc-btn-danger:hover {
    background: rgba(244, 67, 54, 0.25) !important;
}

/* Tabla */
.rc-table-container {
    position: relative;
    min-height: 100px;
}

.rc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.rc-table thead {
    border-bottom: 2px solid var(--rc-border);
}

.rc-table th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rc-table tbody tr {
    border-bottom: 1px solid var(--rc-border);
    transition: background 0.2s ease;
}

.rc-table tbody tr:hover {
    background: var(--rc-bg-hover);
}

.rc-table td {
    padding: 0.6rem 0.5rem;
    vertical-align: middle;
}

.rc-col-name {
    width: auto;
}

.rc-col-points {
    width: 120px;
}

.rc-col-action {
    width: 90px;
    text-align: center;
}

/* Inputs de la tabla */
.rc-table input[type="text"],
.rc-table input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--rc-bg-input);
    border: 1px solid var(--rc-border);
    border-radius: 8px;
    color: var(--rc-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.rc-table input:focus {
    outline: none;
    border-color: var(--rc-accent);
    background: rgba(255, 255, 255, 0.08);
}

.rc-table input::placeholder {
    color: rgba(242, 242, 242, 0.4);
}

/* Estado vacío */
.rc-empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--rc-text-muted);
    display: none;
    flex-direction: column;
    align-items: center;
}

.rc-empty-state.rc-visible {
    display: flex;
}

.rc-empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

/* Sección de calcular */
.rc-calculate-section {
    display: flex;
    justify-content: center;
    padding-top: 0.5rem;
}

/* Resultados */
.rc-hidden {
    display: none !important;
}

.rc-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rc-border);
}

.rc-results-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rc-stats-mini {
    display: flex;
    gap: 0.5rem;
}

.rc-stat-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.rc-stat-badge-accent {
    background: rgba(29, 185, 84, 0.15);
    border-color: rgba(29, 185, 84, 0.4);
    color: #5dd879;
}

/* Tabla de resultados */
.rc-results-table {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--rc-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.rc-results-table table {
    width: 100%;
    border-collapse: collapse;
}

.rc-results-table thead {
    background: rgba(255, 255, 255, 0.05);
}

.rc-results-table th,
.rc-results-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--rc-border);
}

.rc-results-table th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--rc-text-muted);
}

.rc-results-table tbody tr:last-child td {
    border-bottom: none;
}

.rc-results-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.rc-results-table tfoot {
    background: rgba(29, 185, 84, 0.1);
    font-weight: 700;
}

.rc-results-table tfoot th {
    color: var(--rc-text);
    font-size: 0.9rem;
}

.rc-results-table .rc-amount {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-weight: 600;
    color: #5dd879;
}

.rc-results-table .rc-percentage {
    color: var(--rc-text-muted);
    font-size: 0.9rem;
}

/* Herramientas */
.rc-tools {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
    margin-top: 1rem;
}

.rc-tools .cs-glass-btn {
    flex: 1 1 auto;
    margin: 0;
    min-width: 140px;
    justify-content: center;
}

/* Footer */
.rc-footer {
    text-align: center;
    padding: 1rem;
    margin-top: 0.5rem;
}

.rc-note {
    color: var(--rc-text-muted);
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
    line-height: 1.6;
}

.rc-credit {
    color: var(--rc-text-muted);
    font-size: 0.8rem;
    margin: 0;
    opacity: 0.7;
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rc-card-results:not(.rc-hidden) {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.rc-loading {
    animation: pulse 1.5s ease infinite;
    pointer-events: none;
}

/* Toast de copiado */
.rc-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--rc-success);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    z-index: 10000;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .rc-wrap {
        padding: 1rem 0.75rem;
    }
    
    .rc-card {
        padding: 1rem;
    }
    
    .rc-results-header {
        flex-direction: column;
        text-align: center;
    }
    
    .rc-stats-mini {
        justify-content: center;
    }
    
    .rc-col-points {
        width: 90px;
    }
    
    .rc-col-action {
        width: 70px;
    }
}

@media (max-width: 480px) {
    .rc-title {
        font-size: 1.25rem;
    }
    
    .rc-table th,
    .rc-table td {
        padding: 0.5rem 0.3rem;
    }
    
    .rc-results-table th,
    .rc-results-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .rc-wrap .cs-glass-btn {
        padding: 0.45rem 0.7rem;
        font-size: 0.82rem;
    }
    
    /* Apilar botones verticalmente en móviles */
    .rc-nav,
    .rc-tools {
        flex-direction: column;
    }
    
    .rc-nav .cs-glass-btn,
    .rc-tools .cs-glass-btn {
        width: 100%;
        min-width: 0;
    }
}

/* Accesibilidad */
.rc-wrap .cs-glass-btn:focus-visible,
.rc-wrap input:focus-visible {
    outline: 2px solid var(--rc-accent);
    outline-offset: 2px;
}

/* Print */
@media print {
    .rc-nav,
    .rc-tools,
    .rc-calculate-section,
    .rc-footer {
        display: none !important;
    }
    
    .rc-wrap {
        max-width: 100%;
        padding: 0;
    }
    
    .rc-card {
        border: 1px solid #ccc;
        background: #fff;
        color: #000;
    }
    
    .rc-results-table {
        background: #fff;
    }
    
    .rc-results-table th,
    .rc-results-table td {
        border: 1px solid #ccc;
    }
}
