/* KasOS - Modern Desktop Environment Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow: hidden;
    height: 100vh;
    color: #333;
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    /* Animated Gradient Wallpaper */
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: KasOS-gradient-animation 15s ease infinite;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 350px;
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #333;
    font-weight: 300;
}

.login-form input {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    border-color: #667eea;
}

.login-form button {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

#loginBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#registerBtn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.login-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.error-message {
    color: #e74c3c;
    margin-top: 15px;
    font-size: 14px;
}

/* Desktop Environment */
.desktop {
    height: 100vh;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.desktop-icons {
    position: absolute;
    top: 20px;
    left: 20px;
    display: grid;
    grid-template-columns: repeat(6, 90px); /* Fixed number of columns with slightly wider spacing */
    grid-auto-rows: 100px; /* Fixed height for each row */
    gap: 15px 25px; /* Vertical gap 15px, horizontal gap 25px */
    padding: 20px;
    z-index: 1;
    max-width: 80%; /* Prevent icons from stretching across entire desktop */
    max-height: 80vh; /* Limit vertical height */
    overflow-y: auto; /* Allow scrolling if there are many icons */
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center content vertically */
    cursor: pointer;
    padding: 5px;
    /* Add more space between icons to prevent text collision */
    margin: 2px;
    border-radius: 10px;
    transition: all 0.3s ease;
    user-select: none;
    height: 90px; /* Fixed height for consistency */
}

/* Add styling for the icon label text */
.desktop-icon span {
    margin-top: 5px;
    font-size: 12px;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    white-space: nowrap; /* Prevent text from breaking to new line */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for overflow */
    max-width: 85px; /* Limit width to ensure it fits within the icon width */
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.desktop-icon .icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

/* Taskbar */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 15px;
    z-index: 1000;
}

.start-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 15px;
    transition: all 0.3s ease;
}

.start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.task-list {
    flex: 1;
    display: flex;
    gap: 10px;
}

.task-item {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.desktop-switcher {
    display: flex;
    gap: 5px;
    margin-right: 15px;
}

.desktop-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.desktop-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.desktop-btn:hover {
    transform: scale(1.1);
}

.clock {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

/* Start Menu */
.start-menu {
    position: fixed;
    bottom: 60px;
    left: 15px;
    width: 300px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 20px;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

.start-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.start-header span {
    color: white;
    font-weight: 600;
}

#logoutBtn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.start-apps {
    display: grid;
    gap: 10px;
}

.start-app {
    color: white;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-app:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

/* Windows */
.window {
    position: fixed;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 100;
    min-width: 300px;
    min-height: 200px;
}

.window.maximized {
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: calc(100vh - 50px) !important;
    border-radius: 0;
}

.window-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.window-title {
    font-weight: 600;
    font-size: 14px;
}

.window-controls {
    display: flex;
    gap: 5px;
}

.window-controls button {
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.minimize-btn {
    background: #f39c12;
    color: white;
}

.maximize-btn {
    background: #27ae60;
    color: white;
}

.close-btn {
    background: #e74c3c;
    color: white;
}

.window-controls button:hover {
    transform: scale(1.1);
}

.window-content {
    padding: 3px;
    height: calc(100% - 50px);
    overflow-y: auto;
    color: #333;
    background-color: #ffffff;
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    min-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.settings-panel h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.setting-group input,
.setting-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.setting-group input:focus,
.setting-group select:focus {
    border-color: #667eea;
}

.setting-group small {
    color: #666;
    font-size: 12px;
}

#applySettings {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#applySettings:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* App Manager */
.app-manager {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    min-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.app-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.app-section:last-child {
    border-bottom: none;
}

.app-section h4 {
    margin-bottom: 15px;
    color: #333;
}

.installed-app {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.installed-app button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

/* Text color definitions for dark background elements */
.start-app span,
.start-app .app-name {
    color: #ffffff;
}

/* General text elements */
p, div, span, label {
    color: inherit;
}

/* Form elements text color */
input, textarea, select {
    color: #333;
}

/* Ensure buttons have proper text color */
button {
    color: inherit;
}

/* Application content areas */
.app-content,
.application-content {
    color: #333;
    background-color: #ffffff;
}

/* Dark theme elements */
.dark-background,
.dark-panel {
    color: #ffffff;
}

/* Light theme elements */
.light-background,
.light-panel {
    color: #333;
}

/* Additional text color fixes for better visibility */

/* Ensure all text elements in windows have proper color */
.window * {
    color: inherit;
}

/* Text inside apps with dark backgrounds */
.app-container,
.application-window,
.app-window {
    color: #333;
}

/* Navigation and menu elements */
.nav, .menu, .navigation {
    color: inherit;
}

/* Table and list elements */
table, th, td, ul, ol, li {
    color: inherit;
}

/* Headers in applications */
h1, h2, h3, h4, h5, h6 {
    color: inherit;
}

/* Status and notification elements */
.status, .notification, .alert {
    color: inherit;
}

/* Tab content areas */
.tab-content, .tab-pane {
    color: #333;
}

/* Modal and dialog content */
.modal, .dialog, .popup {
    color: #333;
}

/* Card and panel content */
.card, .panel, .content-area {
    color: #333;
}

/* Sidebar content */
.sidebar, .side-panel {
    color: inherit;
}

/* Footer content */
.footer, .bottom-bar {
    color: inherit;
}

/* Code and pre-formatted text */
code, pre, .code {
    color: inherit;
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    opacity: 0.8;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Wallet Authentication Styles */
.wallet-login-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    color: white;
}

.wallet-login-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
}

.wallet-login-btn {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.wallet-login-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.wallet-login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.wallet-login-btn.wallet-connecting {
    animation: walletPulse 1.5s infinite;
}

@keyframes walletPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.wallet-status {
    margin-top: 15px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    min-height: 20px;
}

.wallet-status.success {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.wallet-status.error {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.wallet-status.info {
    background: rgba(23, 162, 184, 0.2);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

.wallet-address {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.wallet-address.show {
    opacity: 1;
    transform: translateY(0);
}

.login-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
}

.login-divider span {
    background: white;
    padding: 0 20px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.traditional-login-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

/* Animation for wallet connection */
.wallet-connecting {
    position: relative;
    overflow: hidden;
}

.wallet-connecting::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: walletShimmer 2s infinite;
}

@keyframes walletShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Responsive design for wallet login */
@media (max-width: 768px) {
    .wallet-login-section {
        margin-bottom: 16px;
        padding: 16px;
    }
    
    .wallet-login-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .login-divider {
        margin: 16px 0;
    }
}

/* Success state for wallet connection */
.wallet-connected {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
}

.wallet-connected .wallet-login-btn {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .traditional-login-section {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .login-divider span {
        background: #2d3748;
        color: #a0aec0;
    }
}

/* Add keyframes for animated gradient (for login screen) */
@keyframes KasOS-gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}