/* Global style reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* Container styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Header styles */
.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.home-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Responsive design for home button */
@media (max-width: 768px) {
    .home-btn {
        position: static;
        display: inline-block;
        margin-bottom: 15px;
    }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content area */
.main-content {
    padding: 40px;
}

/* Converter section */
.converter-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

/* Input group styles */
.input-group {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.input-group:hover {
    border-color: #4facfe;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.1);
}

.input-group h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Color input area */
.color-inputs {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.input-wrapper {
    flex: 1;
    min-width: 80px;
}

.input-wrapper label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.input-wrapper input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: center;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

/* Button group styles */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.convert-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.convert-btn:active {
    transform: translateY(0);
}

/* Result label styles */
.result-label {
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #1976d2;
    text-align: center;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Preview section styles */
.preview-section {
    margin-bottom: 40px;
}

.preview-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bg-btn {
    padding: 12px 20px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 120px;
}

.bg-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.bg-btn.black {
    background: #000;
    color: white;
    border-color: #000;
}

.bg-btn.white {
    background: #ffffff;
    color: #333;
    border-color: #ddd;
}

.bg-btn.rgb {
    /* Background color will be set dynamically by JavaScript */
    transition: all 0.3s ease;
}

/* Color preview styles */
.color-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.preview-container {
    position: relative;
    width: 800px;
    height: 600px;
    border-radius: 15px;
    border: 3px solid #dee2e6;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.preview-bg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 1.1rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
    background-color: black;
}

.preview-fg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 300px;
    border-radius: 10px;
    /* Remove border lines */
    /* border: 2px solid rgba(255, 255, 255, 0.3); */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 1rem;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    transition: all 0.3s ease;
    background-color: black;
    backdrop-filter: blur(1px);
}

.preview-container:hover .preview-fg {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.color-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    backdrop-filter: blur(5px);
}

/* History section styles */
.history-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e9ecef;
}

.history-section h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid #dee2e6;
}

.history-content::-webkit-scrollbar {
    width: 8px;
}

.history-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.history-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Icon styles */
.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}

/* Animation effects */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .converter-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .color-inputs {
        flex-direction: column;
    }

    .button-group {
        flex-direction: column;
    }

    .preview-controls {
        flex-direction: column;
    }

    .preview-container {
        width: 100%;
        max-width: 500px;
        height: 400px;
    }

    .preview-fg {
        width: 250px;
        height: 180px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .main-content {
        padding: 20px;
    }
}