:root {
    --primary-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --info-color: #2196F3;
    --bg-dark: #1a1a1a;
    --bg-card: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.status-card, .info-card, .logs-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.status-header h2 {
    font-size: 1.5em;
}

.btn-refresh {
    background: none;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.5em;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: var(--info-color);
    border-color: var(--info-color);
    transform: rotate(180deg);
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: var(--bg-dark);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.status-item .label {
    color: var(--text-secondary);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-item .value {
    font-size: 1.1em;
    font-weight: 600;
}

.value.loading {
    color: var(--warning-color);
}

.value.online {
    color: var(--primary-color);
}

.value.offline {
    color: var(--text-secondary);
}

.value.error {
    color: var(--danger-color);
}

.progress-bar {
    margin-top: 20px;
    background: var(--bg-dark);
    border-radius: 20px;
    height: 40px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-bar.hidden {
    display: none;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    width: 0%;
    animation: progressAnim 3s ease-in-out infinite;
}

@keyframes progressAnim {
    0%, 100% { width: 0%; }
    50% { width: 100%; }
}

/* ============================================================================
   REFRESH INDICATOR
   ============================================================================ */

.refresh-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.9em;
    animation: spin 1s linear infinite;
}

.refresh-indicator.hidden {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#progressText {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    z-index: 1;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-icon {
    font-size: 1.5em;
}

.btn-start {
    background: linear-gradient(135deg, var(--primary-color) 0%, #66BB6A 100%);
    color: white;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

.btn-start-mc {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
    color: white;
}

.btn-start-mc:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 152, 0, 0.4);
}

.btn-stop {
    background: linear-gradient(135deg, var(--danger-color) 0%, #EF5350 100%);
    color: white;
}

.btn-stop:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(244, 67, 54, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================================
   UTILITIES SECTION
   ============================================================================ */
.utilities-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.utilities-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.2em;
    color: var(--text-primary);
}

.utilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.utility-btn {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(33, 150, 243, 0.1) 100%);
    border: 2px solid rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.utility-btn:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(33, 150, 243, 0.2) 100%);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.3);
}

.utility-icon {
    font-size: 2.5em;
    line-height: 1;
}

.utility-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.utility-title {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-primary);
}

.utility-desc {
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* ============================================================================
   INFO & LOGS
   ============================================================================ */
.info-card h3, .logs-card h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
}

.info-card ul {
    list-style: none;
    padding-left: 0;
}

.info-card li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-card li:last-child {
    border-bottom: none;
}

.info-card strong {
    color: var(--primary-color);
}

.logs-container {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.log-entry {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.success {
    color: var(--primary-color);
}

.log-entry.error {
    color: var(--danger-color);
}

.log-entry.warning {
    color: var(--warning-color);
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.footer-note {
    margin-top: 5px;
    font-size: 0.85em;
}

/* Scrollbar personalizado */
.logs-container::-webkit-scrollbar {
    width: 8px;
}

.logs-container::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}

.logs-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.logs-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 600px) {
    .controls {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   AUTO-STOP STYLES
   ============================================================================ */

.auto-stop-card {
    background: linear-gradient(135deg, #2d2d2d 0%, #3d3d3d 100%);
    border: 2px solid var(--warning-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    transition: all 0.3s ease;
}

.auto-stop-card.hidden {
    display: none;
}

.auto-stop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.auto-stop-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3em;
    color: var(--warning-color);
}

.auto-stop-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auto-stop-badge.active {
    background: rgba(76, 175, 80, 0.2);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.auto-stop-badge.warning {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.auto-stop-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 25px;
    align-items: center;
}

.countdown-circle-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-circle {
    transform: rotate(-90deg);
}

.countdown-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.countdown-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.countdown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.countdown-number {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-primary);
}

.countdown-label {
    font-size: 0.75em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auto-stop-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-dark);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-value {
    font-weight: 600;
    font-size: 1em;
    color: var(--text-primary);
}

.detail-value.warning {
    color: var(--warning-color);
}

.auto-stop-note {
    margin-top: 15px;
    padding: 12px;
    background: rgba(33, 150, 243, 0.1);
    border-left: 3px solid var(--info-color);
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--text-secondary);
    line-height: 1.5;
}

.btn-reset-strikes {
    width: 100%;
    margin-top: 15px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-reset-strikes:hover {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.btn-reset-strikes:active {
    transform: translateY(0);
}

.btn-reset-strikes.hidden {
    display: none;
}

.btn-reset-strikes .btn-icon {
    font-size: 1.1em;
}

/* Responsive para auto-stop */
@media (max-width: 600px) {
    .auto-stop-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .countdown-circle-container {
        margin: 0 auto;
    }
    
    .detail-item {
        flex-direction: column;
        gap: 8px;
    }
}

/* ============================================================================
   METRICS CARD
   ============================================================================ */

.metrics-card {
    margin-top: 25px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.05) 0%, rgba(76, 175, 80, 0.05) 100%);
    border-left: 4px solid #2196F3;
}

.metric-group {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.metric-group:hover {
    background: rgba(255, 255, 255, 0.04);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.metric-label {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.metric-value {
    font-weight: 600;
    font-size: 15px;
    color: #2196F3;
}

.metric-bar {
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.metric-fill {
    height: 100%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.metric-ok {
    background: linear-gradient(90deg, #4CAF50 0%, #66BB6A 100%);
}

.metric-warning {
    background: linear-gradient(90deg, #FFA726 0%, #FFB74D 100%);
}

.metric-danger {
    background: linear-gradient(90deg, #EF5350 0%, #E57373 100%);
}

.metric-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-subtext {
    font-size: 13px;
    color: var(--text-secondary);
}

.metrics-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.metrics-footer span {
    color: #2196F3;
    font-weight: 600;
}

/* ============================================================================
   RCON CARD
   ============================================================================ */

.rcon-card {
    margin-top: 25px;
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.05) 0%, rgba(156, 39, 176, 0.05) 100%);
    border-left: 4px solid #673AB7;
}

.quick-commands {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.btn-rcon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.1) 0%, rgba(156, 39, 176, 0.1) 100%);
    border: 1px solid rgba(103, 58, 183, 0.3);
    border-radius: 10px;
    color: #9C27B0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-rcon:hover {
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.2) 0%, rgba(156, 39, 176, 0.2) 100%);
    border-color: #9C27B0;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.btn-rcon:active {
    transform: translateY(-1px);
}

.btn-rcon .rcon-icon {
    font-size: 1.8em;
}

.custom-command {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.command-input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(103, 58, 183, 0.3);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

.command-input:focus {
    outline: none;
    border-color: #9C27B0;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

.command-input::placeholder {
    color: var(--text-secondary);
}

.btn-execute {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #673AB7 0%, #9C27B0 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.btn-execute:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(156, 39, 176, 0.4);
}

.btn-execute:active {
    transform: translateY(0);
}

.command-output {
    padding: 18px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    border-left: 4px solid #2196F3;
    margin-bottom: 20px;
    min-height: 70px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    transition: all 0.3s ease;
}

.command-output.output-success {
    border-left-color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.command-output.output-error {
    border-left-color: #f44336;
    background: rgba(244, 67, 54, 0.05);
}

.command-output.output-info {
    border-left-color: #2196F3;
    background: rgba(33, 150, 243, 0.05);
}

.command-output pre {
    margin: 0;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.output-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    font-family: system-ui, -apple-system, sans-serif;
}

.command-history {
    margin-top: 20px;
}

.command-history summary {
    cursor: pointer;
    padding: 12px 16px;
    background: rgba(103, 58, 183, 0.1);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
    user-select: none;
}

.command-history summary:hover {
    background: rgba(103, 58, 183, 0.15);
}

.command-history[open] summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 10px;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(156, 39, 176, 0.3);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 39, 176, 0.5);
}

.history-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid #9C27B0;
    margin-bottom: 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(3px);
}

.history-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.history-command {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #9C27B0;
    margin-bottom: 6px;
    font-size: 13px;
}

.history-output {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.history-placeholder {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Responsive para metrics y RCON */
@media (max-width: 600px) {
    .quick-commands {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .custom-command {
        flex-direction: column;
    }
    
    .btn-execute {
        width: 100%;
        justify-content: center;
    }
}
