/* Aoe2MG Groups — estilos medievales
   Paleta consistente con el resto del proyecto (#72604a marrón, #fcab59 naranja) */

.agp-groups-list,
.agp-group-view,
.agp-my-groups,
.agp-create-group {
    max-width: 800px;
    margin: 2em auto;
    padding: 1.5em;
    background: #1f1812;
    border: 1px solid #72604a;
    border-radius: 6px;
    color: #f0e7d8;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.agp-group-view--full {
    max-width: 1100px;
    padding: 2em;
}

/* Encabezados */
.agp-groups-list h2,
.agp-group-view h2,
.agp-my-groups h2,
.agp-create-group h2 {
    color: #fcab59;
    margin-top: 0;
    border-bottom: 1px solid #72604a;
    padding-bottom: 0.4em;
}

.agp-group-view h3,
.agp-my-groups h3 {
    color: #fcab59;
    margin-top: 1.6em;
    border-bottom: 1px solid #4d4234;
    padding-bottom: 0.25em;
}

/* Lista de grupos */
.agp-group-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.agp-group-item {
    padding: 0.8em 0;
    border-bottom: 1px solid #4d4234;
}

.agp-group-item:last-child {
    border-bottom: none;
}

.agp-group-link {
    color: #fcab59;
    text-decoration: none;
    font-size: 1.1em;
}

.agp-group-link:hover {
    text-decoration: underline;
}

.agp-group-meta {
    display: block;
    font-size: 0.85em;
    color: #b3a78f;
    margin: 0.2em 0;
}

.agp-group-desc {
    margin: 0.4em 0 0;
    color: #cfc4ad;
    font-size: 0.95em;
}

/* Etiquetas */
.agp-tag {
    display: inline-block;
    padding: 0.1em 0.5em;
    border-radius: 3px;
    font-size: 0.75em;
    margin-left: 0.4em;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agp-tag-public  { background: #3a5a3a; color: #d0e8d0; }
.agp-tag-private { background: #5a3a3a; color: #e8d0d0; }
.agp-tag-owner   { background: #fcab59; color: #2a1f10; font-weight: 600; }
.agp-tag-pending { background: #5a5a3a; color: #e8e0c0; }

/* Botones */
.agp-btn {
    display: inline-block;
    padding: 0.5em 1.2em;
    background: #4d4234;
    color: #f0e7d8;
    border: 1px solid #72604a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}

.agp-btn:hover {
    background: #5d5044;
}

.agp-btn-primary {
    background: #fcab59;
    color: #2a1f10;
    border-color: #fcab59;
    font-weight: 600;
}

.agp-btn-primary:hover {
    background: #fdc070;
}

.agp-btn-danger {
    background: #7a2a2a;
    color: #f0d0d0;
    border-color: #a04040;
}

.agp-btn-danger:hover {
    background: #8a3a3a;
}

.agp-btn-small {
    padding: 0.25em 0.6em;
    font-size: 0.8em;
}

/* Forms */
.agp-form {
    margin: 1em 0;
}

.agp-form-inline {
    display: inline-block;
    margin: 0 0.4em 0 0;
}

.agp-input,
.agp-textarea {
    width: 100%;
    max-width: 500px;
    padding: 0.5em;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid #72604a;
    border-radius: 3px;
    color: #f0e7d8;
    font-family: inherit;
    font-size: 1em;
}

.agp-textarea {
    resize: vertical;
    font-family: inherit;
}

.agp-form label {
    display: block;
    margin: 0.6em 0;
    color: #cfc4ad;
}

/* Invitación */
.agp-invite-code {
    background: #2a1f10;
    color: #fcab59;
    padding: 0.2em 0.6em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.agp-group-invite {
    background: rgba(252, 171, 89, 0.08);
    border-left: 3px solid #fcab59;
    padding: 0.6em 1em;
    margin: 1em 0;
    border-radius: 3px;
}

/* Chat */
.agp-group-chat {
    margin: 30px 0;
    padding: 22px;
    background: rgba(31, 24, 18, 0.4);
    border: 1px solid #4d4234;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.agp-message-list {
    list-style: none;
    padding: 1.2em;
    margin: 1.2em 0;
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid #4d4234;
    border-radius: 6px;
    background: #120b06;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar personalizado medieval */
.agp-message-list::-webkit-scrollbar {
    width: 6px;
}
.agp-message-list::-webkit-scrollbar-track {
    background: #120b06;
}
.agp-message-list::-webkit-scrollbar-thumb {
    background: #4d4234;
    border-radius: 3px;
}
.agp-message-list::-webkit-scrollbar-thumb:hover {
    background: #fcab59;
}

.agp-message {
    padding: 12px 16px;
    color: #ebdcc5;
    background: #231c15;
    border: 1px solid rgba(114, 96, 74, 0.25);
    border-radius: 12px 12px 12px 2px;
    max-width: 80%;
    align-self: flex-start;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
    word-break: break-word;
    font-size: 15px;
}

.agp-message:hover {
    transform: translateY(-1px);
}

/* Mensajes propios alineados a la derecha */
.agp-message--self {
    align-self: flex-end;
    background: rgba(252, 171, 89, 0.12);
    border: 1px solid rgba(252, 171, 89, 0.35);
    border-radius: 12px 12px 2px 12px;
}

.agp-message-meta {
    font-size: 0.8em;
    color: #b3a78f;
    margin-bottom: 0.4em;
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 8px;
}

.agp-message-meta strong {
    color: #fcab59;
}

.agp-message-meta small {
    color: #8c826e;
    font-size: 0.88em;
}

.agp-message-body {
    color: #ebdcc5;
    line-height: 1.5;
    font-size: 14.5px;
}

.agp-form-chat textarea {
    margin-top: 0.4em;
    margin-bottom: 0.6em;
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Flash messages */
.agp-flash {
    padding: 0.7em 1em;
    border-radius: 4px;
    margin: 1em 0;
}

.agp-flash-ok  { background: rgba(58, 90, 58, 0.4);  color: #d0e8d0; border-left: 3px solid #4a7a4a; }
.agp-flash-err { background: rgba(122, 42, 42, 0.4); color: #f0d0d0; border-left: 3px solid #a04040; }

/* Member list */
.agp-member-list,
.agp-pending-list {
    list-style: none;
    padding: 0;
    margin: 0.5em 0;
    background: #2a1f10;
    border: 1px solid #4d4234;
    border-radius: 4px;
    overflow: hidden;
}

.agp-member-list li,
.agp-pending-list li {
    padding: 0.6em 1em;
    border-bottom: 1px solid #4d4234;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
    color: #f0e7d8;
}

.agp-member-list li:nth-child(even),
.agp-pending-list li:nth-child(even) {
    background: rgba(114, 96, 74, 0.15);
}

.agp-member-list li:last-child,
.agp-pending-list li:last-child {
    border-bottom: none;
}

.agp-member-list strong,
.agp-pending-list strong {
    color: #fcab59;
}

/* Admin section */
.agp-group-admin {
    background: rgba(114, 96, 74, 0.12);
    border: 1px solid #4d4234;
    border-radius: 4px;
    padding: 1em 1.2em;
    margin: 1.5em 0;
}

/* Public groups: code entry form */
.agp-intro {
    color: #cfc4ad;
    font-style: italic;
    margin: -0.5em 0 1em;
}

.agp-code-entry-form {
    background: rgba(252, 171, 89, 0.06);
    border: 1px solid #72604a;
    border-left: 4px solid #fcab59;
    border-radius: 4px;
    padding: 1em 1.2em;
    margin: 1em 0 1.5em;
}

.agp-code-entry-form label {
    display: block;
    margin-bottom: 0.4em;
    color: #cfc4ad;
    font-weight: 600;
}

.agp-input-code {
    width: 200px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 1.1em !important;
    text-align: center;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.agp-form-hint {
    display: block;
    margin-top: 0.5em;
    color: #b3a78f;
    font-size: 0.85em;
    font-style: italic;
}

/* User profile */
.agp-user-profile {
    max-width: 800px;
    margin: 2em auto;
    padding: 1.5em;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #72604a;
    border-radius: 6px;
    color: #f0e7d8;
}

.agp-profile-header {
    display: flex;
    align-items: center;
    gap: 1.2em;
    padding-bottom: 1em;
    border-bottom: 1px solid #4d4234;
    margin-bottom: 1.5em;
}

.agp-profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 2px solid #fcab59;
    flex-shrink: 0;
}

.agp-profile-avatar-placeholder {
    background: #2a1f10;
    color: #fcab59;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4em;
    font-weight: 700;
}

.agp-profile-meta h2 {
    color: #fcab59;
    margin: 0 0 0.3em;
    border: none;
    padding: 0;
}

.agp-profile-userdata,
.agp-profile-quick {
    margin: 0.3em 0;
    color: #cfc4ad;
    font-size: 0.95em;
}

.agp-profile-section {
    margin: 1.5em 0;
}

.agp-profile-section h3 {
    color: #fcab59;
    margin-top: 0;
    border-bottom: 1px solid #4d4234;
    padding-bottom: 0.3em;
}

.agp-tag-self  { background: #2a1f10; color: #fcab59; border: 1px solid #fcab59; }
.agp-tag-admin { background: #5a2a2a; color: #f0d0d0; }

/* Stats table in profile */
.agp-profile-stats {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5em 0;
}

.agp-profile-stats th,
.agp-profile-stats td {
    padding: 0.5em 0.8em;
    text-align: left;
    border-bottom: 1px solid #2a1f10;
}

.agp-profile-stats thead th {
    background: #2a1f10;
    color: #fcab59;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agp-profile-stats tbody tr:hover {
    background: rgba(252, 171, 89, 0.05);
}

/* Season standings (integración con aoe2mg-seasons) */
.agp-group-season-standings {
    margin: 25px 0;
    padding: 22px;
    background: linear-gradient(135deg, rgba(31, 24, 18, 0.9) 0%, rgba(21, 15, 10, 0.95) 100%);
    border: 1px solid #72604a;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(252, 171, 89, 0.05);
}

.agp-season-heading {
    margin: 0 0 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fcab59;
    font-size: 1.15em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #72604a;
}

/* Micro-animación de trofeo medieval */
@keyframes spinTrophy {
    0% { transform: rotate(0deg) scale(1); }
    30% { transform: rotate(15deg) scale(1.15); }
    70% { transform: rotate(-15deg) scale(1.15); }
    100% { transform: rotate(0deg) scale(1); }
}

.agp-group-season-standings:hover .agp-season-trophy {
    animation: spinTrophy 0.8s ease-in-out;
}

.agp-season-trophy {
    color: #fcab59;
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.agp-season-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    font-size: 15px;
    color: #f0e7d8;
}

.agp-season-table thead th {
    padding: 12px 16px;
    text-align: left;
    background: #2a1f10;
    color: #fcab59;
    font-size: 0.88em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #72604a;
}

.agp-season-table .agp-col-num {
    text-align: right;
    padding-right: 16px;
}

.agp-season-table .agp-col-pos {
    width: 70px;
    text-align: center;
}

.agp-season-table .agp-col-total {
    font-weight: 700;
    color: #fcab59;
}

.agp-season-row td {
    padding: 14px 16px;
    border-bottom: 1px solid #4d4234;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.agp-season-row:hover td {
    background: rgba(252, 171, 89, 0.05);
}

.agp-season-row:nth-child(even) td {
    background: rgba(114, 96, 74, 0.08);
}

/* Fila especial para resaltar al usuario actual de forma premium */
.agp-season-row--current td {
    background: rgba(252, 171, 89, 0.12) !important;
    border-top: 1px solid rgba(252, 171, 89, 0.25);
    border-bottom: 1px solid rgba(252, 171, 89, 0.25) !important;
}

.agp-season-row--current {
    border-left: 4px solid #fcab59;
}

.agp-season-row--current td strong {
    color: #fff;
    text-shadow: 0 0 4px rgba(252, 171, 89, 0.6);
}

.agp-season-userlogin {
    font-size: 11px;
    color: #b3a78f;
    display: inline-block;
    margin-left: 6px;
}

.agp-rank-badge {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    background: #4d4234;
    color: #ebdcc5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Medallas medievales con degradados premium */
.agp-rank-1 {
    background: linear-gradient(135deg, #ffe066 0%, #f59f00 100%);
    color: #1f1812;
    border: 1px solid #ffe066;
    box-shadow: 0 0 8px rgba(245, 159, 0, 0.45);
}
.agp-rank-2 {
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    color: #1f1812;
    border: 1px solid #ffffff;
    box-shadow: 0 0 8px rgba(203, 213, 225, 0.35);
}
.agp-rank-3 {
    background: linear-gradient(135deg, #f5d0a9 0%, #b87333 100%);
    color: #ffffff;
    border: 1px solid #f5d0a9;
    box-shadow: 0 0 8px rgba(184, 115, 51, 0.35);
}

/* Profile edit form (nickname + password) */
.agp-profile-edit {
    margin-top: 2em;
    padding: 1.2em 1.5em;
    background: rgba(252, 171, 89, 0.04);
    border: 1px solid #72604a;
    border-left: 4px solid #fcab59;
    border-radius: 4px;
}

.agp-profile-edit > h3 {
    color: #fcab59;
    margin-top: 0;
    border: none;
    padding: 0 0 0.4em;
}

.agp-profile-edit-form label {
    display: block;
    margin: 1em 0 0.4em;
    color: #cfc4ad;
    font-weight: 600;
}

.agp-profile-edit-form .agp-input {
    margin-top: 0.3em;
    font-size: 0.95em;
}

.agp-profile-edit-password {
    border: 1px solid #4d4234;
    border-radius: 4px;
    padding: 0.6em 1em 0.2em;
    margin: 1.2em 0;
}

.agp-profile-edit-password legend {
    color: #fcab59;
    padding: 0 0.4em;
    font-weight: 600;
    font-size: 0.95em;
}

.agp-profile-edit-password label {
    margin: 0.6em 0;
}

.agp-profile-edit-form button[type="submit"] {
    margin-top: 1em;
}

/* Formulario de búsqueda */
.agp-search-form {
    margin: 1.5em 0;
    display: flex;
    gap: 8px;
}

.agp-search-form .agp-input {
    flex-grow: 1;
    max-width: none !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid #72604a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agp-search-form .agp-input:focus {
    border-color: #fcab59;
    box-shadow: 0 0 8px rgba(252, 171, 89, 0.2);
    outline: none;
}

.agp-btn-clear {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
/* Enlace en mayúsculas (código de invitación en el listado) */
.agp-link--upper {
    text-transform: uppercase;
}
