/* Ratnarok Online - Styles */

:root {
    --primary: #8B4513;
    --secondary: #FFD700;
    --accent: #4169E1;
    --danger: #DC143C;
    --success: #32CD32;
    --dark: #1a1a2e;
    --darker: #0f0f1e;
    --light: #eee;
    --hp-color: #ff4444;
    --mp-color: #4444ff;
    --exp-color: #44ff44;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    color: var(--light);
    overflow: hidden;
    height: 100vh;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: flex;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-container {
    text-align: center;
}

.logo h1 {
    font-size: 4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.tagline {
    font-size: 1.2rem;
    color: var(--secondary);
    margin-bottom: 3rem;
    opacity: 0.9;
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    min-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab {
    flex: 1;
    padding: 0.75rem;
    background: transparent;
    border: none;
    color: var(--light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
}

.tab.active {
    border-bottom-color: var(--secondary);
    color: var(--secondary);
}

.tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.form-content {
    display: none;
}

.form-content.active {
    display: block;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--light);
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--light);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: var(--dark);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.error-message {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 20px;
}

/* Character Screen */
#character-screen {
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.character-container {
    text-align: center;
}

.character-container h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--secondary);
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: 800px;
}

.character-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.character-card:hover {
    transform: translateY(-5px);
    border-color: var(--secondary);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.2);
}

.character-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.character-card .class-name {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.character-card .level {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--dark);
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--secondary);
}

.class-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.class-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-align: center;
}

.class-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.class-card.selected {
    border-color: var(--secondary);
    background: rgba(255, 215, 0, 0.1);
}

.class-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.class-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: var(--secondary);
}

.class-card p {
    font-size: 0.9rem;
    color: var(--light);
    opacity: 0.8;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Game Screen */
#game-screen {
    position: relative;
}

#game-canvas {
    display: block;
    background: #000;
}

.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.game-ui > * {
    pointer-events: auto;
}

/* Top Bar */
.top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 2rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.character-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.char-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary);
}

.char-level {
    font-size: 0.9rem;
    color: var(--light);
    opacity: 0.8;
}

.stats-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bar-label {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 30px;
}

.hp-bar .bar-label { color: var(--hp-color); }
.mp-bar .bar-label { color: var(--mp-color); }

.bar-bg {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.hp-bar .bar-fill {
    background: linear-gradient(90deg, var(--hp-color), #ff6666);
}

.mp-bar .bar-fill {
    background: linear-gradient(90deg, var(--mp-color), #6666ff);
}

.exp-bar .bar-fill {
    background: linear-gradient(90deg, var(--exp-color), #66ff66);
}

.bar-text {
    font-size: 0.85rem;
    min-width: 80px;
    text-align: right;
}

.exp-bar {
    position: relative;
}

.exp-bar .bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.currency {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
}

/* Skill Bar */
.skill-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 0.75rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.skill-slots {
    display: flex;
    gap: 0.5rem;
}

.skill-slot {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.skill-slot:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.skill-slot.on-cooldown {
    opacity: 0.5;
    cursor: not-allowed;
}

.skill-slot .cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 0 0 8px 8px;
    font-size: 0.7rem;
    padding: 2px;
}

/* UI Buttons */
.ui-btn {
    position: absolute;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ui-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

#inventory-btn {
    top: 120px;
    right: 20px;
}

#stats-btn {
    top: 170px;
    right: 20px;
}

/* Chat Box */
.chat-box {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 400px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.chat-messages {
    height: 150px;
    overflow-y: auto;
    padding: 1rem;
    font-size: 0.9rem;
}

.chat-message {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.chat-message .sender {
    color: var(--secondary);
    font-weight: 600;
}

#chat-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--light);
    font-size: 0.9rem;
}

#chat-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
}

/* Windows */
.window {
    display: none;
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    min-width: 400px;
}

.window.active {
    display: block;
}

#inventory-window {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
}

#stats-window {
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    width: 400px;
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.window-header h3 {
    font-size: 1.5rem;
    color: var(--secondary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--light);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    color: var(--danger);
    transform: scale(1.2);
}

.window-content {
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

/* Inventory */
.equipment-slots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.equipment-slot {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.slot-label {
    font-size: 0.7rem;
    color: var(--light);
    opacity: 0.6;
    text-align: center;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.inventory-item {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.inventory-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.inventory-item.rarity-common { border-color: #fff; }
.inventory-item.rarity-uncommon { border-color: #32CD32; }
.inventory-item.rarity-rare { border-color: #4169E1; }
.inventory-item.rarity-epic { border-color: #9370DB; }
.inventory-item.rarity-legendary { border-color: #FFD700; }

.item-quantity {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    gap: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.stat-name {
    font-weight: 600;
    color: var(--secondary);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.stat-increase {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--success);
    font-size: 1.2rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stat-increase:hover {
    background: var(--success);
    color: var(--dark);
    transform: scale(1.1);
}

.stat-increase:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.character-card, .class-card {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .login-box {
        min-width: 90%;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .chat-box {
        width: calc(100% - 40px);
    }
    
    #inventory-window, #stats-window {
        width: 90%;
        left: 50%;
        transform: translate(-50%, -50%);
        top: 50%;
        right: auto;
    }
}
