* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2ecc71;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --gray: #95a5a6;
    --text: #34495e;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --text-primary: #34495e;
    --text-secondary: #7f8c8d;
    --card-bg: #ffffff;
    --border-color: #e1e4e8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background: var(--bg-secondary);
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    background: var(--dark);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links span {
    margin: 0 1rem;
    color: var(--secondary);
    font-weight: bold;
}

.section {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 10px;
    margin: 2rem 0;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: var(--light);
    color: var(--text);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.feature h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.auth-form {
    max-width: 400px;
    margin: 3rem auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--light);
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--gray);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-tab {
    display: none;
}

.auth-tab.active {
    display: flex;
    flex-direction: column;
}

.auth-tab input {
    padding: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--light);
    border-radius: 5px;
    font-size: 1rem;
}

.auth-tab input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.marketplace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-width: 300px;
}

.search-bar input,
.search-bar select {
    padding: 10px 15px;
    border: 1px solid var(--light);
    border-radius: 5px;
    font-size: 1rem;
}

.search-bar input {
    flex: 1;
}

.domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.domain-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.domain-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.domain-card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.domain-name {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.domain-owner {
    font-size: 0.9rem;
    opacity: 0.9;
}

.domain-card-body {
    padding: 1.5rem;
    flex: 1;
}

.domain-price {
    font-size: 1.5rem;
    color: var(--secondary);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.domain-value {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.domain-description {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.domain-card-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.domain-card-footer button {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.valuate-container {
    max-width: 500px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.valuate-form {
    display: flex;
    flex-direction: column;
}

.valuate-form label {
    margin-top: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.domain-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.domain-input-group input,
.domain-input-group select {
    padding: 10px 12px;
    border: 1px solid var(--light);
    border-radius: 5px;
    font-size: 1rem;
}

.domain-input-group input {
    flex: 1;
}

.domain-input-group span {
    font-weight: bold;
    color: var(--text);
}

.valuate-form input {
    padding: 10px 12px;
    border: 1px solid var(--light);
    border-radius: 5px;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.valuate-form button {
    margin-top: 1.5rem;
}

.valuation-result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--secondary) 0%, #27ae60 100%);
    color: white;
    border-radius: 10px;
    text-align: center;
}

.value-display {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 1rem 0;
}

.sell-form-container {
    max-width: 500px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.sell-form-container form {
    display: flex;
    flex-direction: column;
}

.sell-form-container label {
    margin-top: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.sell-form-container input,
.sell-form-container select,
.sell-form-container textarea {
    padding: 10px 12px;
    border: 1px solid var(--light);
    border-radius: 5px;
    font-size: 1rem;
    margin-top: 0.5rem;
    font-family: inherit;
}

.sell-form-container textarea {
    resize: vertical;
}

.estimate-box {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 5px;
    text-align: center;
}

.estimate-box p {
    margin: 0;
}

.sell-form-container form button {
    margin-top: 1.5rem;
}

.portfolio-tabs {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    border-bottom: 2px solid var(--light);
}

.portfolio-tab {
    display: none;
}

.portfolio-tab.active {
    display: block;
}

.transactions-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.transaction-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

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

.transaction-details {
    flex: 1;
}

.transaction-domain {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.transaction-type {
    font-size: 0.9rem;
    color: var(--gray);
}

.transaction-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--secondary);
}

.transaction-date {
    font-size: 0.9rem;
    color: var(--gray);
}

.portfolio-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 10px;
    text-align: center;
}

.portfolio-summary h3 {
    font-size: 1.5rem;
    margin: 0;
}

#domainDetailContent {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-title {
    flex: 1;
}

.detail-title h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.detail-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary);
}

.detail-value {
    color: var(--gray);
    font-size: 0.9rem;
}

.detail-owner {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--light);
    border-radius: 5px;
}

.detail-description {
    margin: 1.5rem 0;
    line-height: 1.8;
}

.detail-keywords {
    margin: 1rem 0;
}

.keyword-tag {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .domains-grid {
        grid-template-columns: 1fr;
    }

    .marketplace-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        flex-direction: column;
    }

    .detail-header {
        flex-direction: column;
    }

    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Utility classes for show/hide */
.hidden {
    display: none !important;
}

.logout-link {
    color: #e74c3c !important;
}

.back-button {
    margin-bottom: 20px;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--secondary);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: #f39c12;
}

.toast.info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--dark);
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text);
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.toast-close:hover {
    background: rgba(0,0,0,0.05);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOut 0.3s ease-out forwards;
}

/* Offers System */
.offers-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.offer-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.offer-card.pending {
    border-left: 4px solid var(--primary);
}

.offer-card.accepted {
    border-left: 4px solid var(--secondary);
}

.offer-card.rejected {
    border-left: 4px solid var(--gray);
}

.offer-info {
    flex: 1;
}

.offer-domain {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.offer-amount {
    font-size: 1.5rem;
    color: var(--secondary);
    font-weight: bold;
    margin: 0.5rem 0;
}

.offer-meta {
    font-size: 0.9rem;
    color: var(--gray);
}

.offer-message {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-style: italic;
}

.offer-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.offer-status.pending {
    background: #e3f2fd;
    color: var(--primary);
}

.offer-status.accepted {
    background: #e8f5e9;
    color: var(--secondary);
}

.offer-status.rejected {
    background: #f3f4f6;
    color: var(--gray);
}

.offer-actions {
    display: flex;
    gap: 0.5rem;
}

.make-offer-form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 1rem;
}

.make-offer-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.make-offer-form input,
.make-offer-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
        font-size: 0.85rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .domains-grid {
        grid-template-columns: 1fr;
    }
    
    .domain-card-footer {
        flex-direction: column;
    }
    
    .domain-card-footer .btn {
        width: 100%;
    }
    
    .marketplace-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar input,
    .search-bar select {
        width: 100%;
    }
    
    .portfolio-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .portfolio-tabs .tab-btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 140px;
        font-size: 0.85rem;
    }
    
    .offer-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .offer-actions {
        width: 100%;
    }
    
    .offer-actions .btn {
        flex: 1;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .detail-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .detail-header .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    .domain-card {
        padding: 1rem;
    }
    
    .offer-domain {
        font-size: 1rem;
    }
    
    .offer-amount {
        font-size: 1.25rem;
    }
}

/* Loading States and Animations */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.skeleton-title {
    height: 24px;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-text.short {
    width: 40%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Dark Mode */
body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --card-bg: #242424;
    --border-color: #3a3a3a;
    --primary: #5dade2;
    --secondary: #52c77f;
    --danger: #e74c3c;
    --dark: #121212;
    --light: #2d2d2d;
    --gray: #adb5bd;
}

.domain-card,
.offer-card,
.transaction-item,
.auth-form,
.sell-form-container,
.valuate-container,
.make-offer-form,
.skeleton-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: background 0.3s, border 0.3s;
}

.feature,
.estimate-box,
.valuation-result {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

input,
textarea,
select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
    transition: background 0.3s, color 0.3s, border 0.3s;
}

.dark-mode-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.3s, background 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

.dark-mode-toggle .sun {
    display: block;
}

.dark-mode-toggle .moon {
    display: none;
}

body.dark-mode .dark-mode-toggle .sun {
    display: none;
}

body.dark-mode .dark-mode-toggle .moon {
    display: block;
}

body.dark-mode .hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5f8f 100%);
}

body.dark-mode .toast {
    background: var(--card-bg);
    color: var(--text-primary);
}

body.dark-mode .offer-message {
    background: var(--bg-secondary);
}
