:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(148, 163, 184, 0.1);
    --primary-color: #38bdf8;
    --accent-color: #f472b6;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --success-color: #4ade80;
    --danger-color: #f87171;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background Globes */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.globe-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-color);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.globe-3 {
    width: 200px;
    height: 200px;
    background: var(--success-color);
    top: 40%;
    left: 40%;
    opacity: 0.2;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(30px, -50px);
    }

    66% {
        transform: translate(-20px, 20px);
    }
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(56, 189, 248, 0.3);
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    align-items: stretch;
}

@media (max-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease;
}



/* Form Styles */
.form-panel {
    margin-bottom: 3rem;
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(244, 114, 182, 0.3);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 114, 182, 0.5);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 2rem 0;
    color: var(--text-secondary);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--card-border);
}

.divider span {
    padding: 0 1rem;
    font-size: 1.2rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Contracts Grid */
.contracts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

/* Contract Card (Miniature version of old display panel) */
.contract-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.contract-card:hover {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.4);
}

.contract-card.ended {
    opacity: 0.8;
    filter: grayscale(0.8);
    border-color: var(--text-secondary);
}

.contract-card.ended:hover {
    filter: grayscale(0);
    opacity: 1;
}

/* Cloud Status Indicator */
.cloud-status {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 30px;
    border: 1px solid var(--card-border);
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    transition: all 0.3s;
}

.status-dot.online {
    background-color: var(--success-color);
    box-shadow: 0 0 10px var(--success-color), 0 0 20px rgba(74, 222, 128, 0.4);
}

.status-dot.error {
    background-color: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
}

.status-dot.loading {
    background-color: var(--primary-color);
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

/* Action Buttons */
.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.btn-edit {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary-color);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.btn-edit:hover {
    background: rgba(56, 189, 248, 0.3);
}

.btn-delete {
    background: rgba(248, 113, 113, 0.2);
    color: var(--danger-color);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-delete:hover {
    background: rgba(248, 113, 113, 0.3);
}

.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--card-border);
}

.contract-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-ended {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.contract-parties {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    gap: 1rem;
    color: var(--primary-color);
}

.contract-total {
    text-align: center;
    margin-bottom: 1.5rem;
}

.contract-total .amount {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.contract-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.detail-item {
    background: rgba(15, 23, 42, 0.4);
    padding: 0.8rem;
    border-radius: 10px;
}

.detail-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}

.detail-value {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
}

.contract-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-end {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(248, 113, 113, 0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-end:hover {
    background: rgba(248, 113, 113, 0.25);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 20px;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--card-border);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
}

#previewImage {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.btn-download {
    background: var(--success-color);
    color: #0f172a;
    padding: 0.8rem 2rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
}

.panel-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.panel-header h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

/* Form Styles */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
}

.input-wrapper input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}