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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1B365D 0%, #2C5282 25%, #3182CE 75%, #4299E1 100%);
    min-height: 100vh;
    padding: 20px;
}

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

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .friend-input {
        flex-direction: column;
    }
    
    .friend-input input {
        margin-bottom: 10px;
    }
    
    .friend-item {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .friend-info {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .balance-table {
        font-size: 14px;
    }
    
    .balance-table th,
    .balance-table td {
        padding: 8px 4px;
    }
    
    .settlement-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .settlement-arrow {
        transform: rotate(90deg);
        margin: 5px 0;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: linear-gradient(145deg, #FFFFFF 0%, #F7FAFC 100%);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(27, 54, 93, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.card h2 {
    color: #1A365D;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.friend-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.friend-input input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.friend-input input:focus {
    outline: none;
    border-color: #2B6CB0;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #2B6CB0 0%, #2C5282 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2A4A6B 0%, #1A365D 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #38A169 0%, #2F855A 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #2F855A 0%, #276749 100%);
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #2B6CB0 0%, #2C5282 100%);
    color: white;
    padding: 8px 12px;
    font-size: 14px;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #2A4A6B 0%, #1A365D 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.3);
}

.friends-list {
    margin-top: 20px;
}

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 50%, #F1F5F9 100%);
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.friend-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #2B6CB0 0%, #3182CE 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.friend-item:hover {
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 50%, #E2E8F0 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(27, 54, 93, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
    border-color: rgba(43, 108, 176, 0.3);
}

.friend-item:hover::before {
    opacity: 1;
}

.friend-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-weight: 700;
    color: #1A365D;
    font-size: 18px;
    line-height: 1.2;
    word-break: break-word;
}

.friend-amount {
    color: #2C5282;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #EBF8FF 0%, #BEE3F8 100%);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(43, 108, 176, 0.2);
}

.friend-amount::before {
    content: '₪';
    font-weight: 500;
    margin-right: 2px;
}

.friend-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.friend-item:hover .friend-actions {
    opacity: 1;
}

.action-btn {
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.action-btn-edit {
    background: linear-gradient(135deg, #2B6CB0 0%, #2C5282 100%);
    color: white;
}

.action-btn-edit:hover {
    background: linear-gradient(135deg, #2A4A6B 0%, #1A365D 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.3);
}

.action-btn-delete {
    background: linear-gradient(135deg, #2B6CB0 0%, #2C5282 100%);
    color: white;
}

.action-btn-delete:hover {
    background: linear-gradient(135deg, #2A4A6B 0%, #1A365D 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.3);
}

.results {
    display: none;
    grid-column: 1 / -1;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.summary-card {
    background: linear-gradient(135deg, #2B6CB0 0%, #2C5282 50%, #1A365D 100%);
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%);
}

.summary-item {
    margin-bottom: 15px;
}

.summary-label {
    font-size: 14px;
    opacity: 0.9;
}

.summary-value {
    font-size: 24px;
    font-weight: bold;
}

.balance-table {
    overflow-x: auto;
}

.balance-table table {
    width: 100%;
    border-collapse: collapse;
}

.balance-table th,
.balance-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.balance-table th {
    background: linear-gradient(135deg, #EDF2F7 0%, #E2E8F0 100%);
    font-weight: 700;
    color: #1A365D;
}

.status-owed {
    color: #38A169;
    font-weight: 600;
}

.status-owes {
    color: #E53E3E;
    font-weight: 600;
}

.status-even {
    color: #2C5282;
    font-weight: 600;
}

.settlements {
    margin-top: 20px;
}

.settlement-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #F7FAFC 0%, #EDF2F7 100%);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: all 0.2s ease;
}

.settlement-item:hover {
    background: linear-gradient(135deg, #EDF2F7 0%, #E2E8F0 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(27, 54, 93, 0.1);
}

.settlement-arrow {
    margin: 0 15px;
    color: #2C5282;
    font-size: 18px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid rgba(226, 232, 240, 0.3);
    border-top: 4px solid #2B6CB0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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